How Tangem Integrates a Network and Token in the Wallet

Every day, we receive hundreds of user requests to integrate new tokens and chains from popular and obscure Web3 projects into Tangem Wallet. Adding a new blockchain network or token into the Tangem wallet follows a systematic process, requiring cooperation between our blockchain analysts and our hardworking developers.

In this article, we describe the process from analysis and development to testing and bug fixing. Hopefully, you will understand why it's worth waiting for your favorite crypto to appear in your Tangem Wallet, which can take so long. 

First, how does Tangem accept requests for new tokens and networks?

Due to unpleasant scenarios where members of a project's community spam our social channels with requests, we want to clarify that Tangem retains the right to decide which networks or tokens to integrate in its wallet.

Accepting user requests for token/network integration 

Users submit requests for new token integrations through our public Telegram chat, X(Twitter), and Discord

While this request mechanism appears somewhat convenient, it poses a challenge for the support team, as consolidating token requests from multiple platforms into a single file becomes cumbersome. 

However, we maintain this internal file, which organizes and ranks the most requested tokens based on the number of user submissions.

Then, we consider the technical specifications of the top-ranking blockchain and its ecosystem, including the following:

  • Detailed information on the architecture, consensus mechanism, transaction speed, block size, and any unique features of the blockchain.
     
  • Documentation on smart contract capabilities, scripting languages, and supported token standards.
     
  • Integration protocols and APIs for connecting to external services.
     
  • Compatibility with popular third-party tools, wallets, or other relevant services.

We also assess the scope of the desired integration:

  • Clearly defined objectives and goals for the integration.
     
  • Specific functionalities or services to be integrated.
     
  • Any customization requirements or specific parameters for the integration process.

Part I: Analyzing the blockchain network 

Before integrating the token or chain at the top of our list, we thoroughly analyze the following factors:

Is the requested network a clone of an already existing network? 

A cloned blockchain network is a duplicate or replica of an existing blockchain. Cloning refers to creating a new blockchain that shares the same codebase, rules, and structure as an existing blockchain. Cloned blockchains can be used to create alternative versions of existing projects. 

For example, a development team might clone a successful blockchain to create a new cryptocurrency with some modifications or improvements. These modifications could include changes to the consensus algorithm, block time, tokenomics, or other parameters.

Integrating a requested network becomes significantly easier for us if it's a clone. In such cases, the integration can be a smoother process. However, if the network is not a clone, we move on to the next step in the analysis.

What's the signature algorithm? 

A signature algorithm is a set of rules and procedures to create and verify digital signatures. Digital signatures ensure the authenticity, integrity, and non-repudiation of transactions. Here's a brief overview of how a typical signature algorithm works:

  • Key generation: The process begins with generating a pair of private and public cryptographic keys. The private key is kept secret and known only to the entity creating the signature, while the public key is shared with others.
     
  • Signing: To create a digital signature, the entity uses its private key to perform a mathematical operation on a hash (a fixed-size string derived from the signed message).
     
  • Verification: Anyone accessing the public key can verify the digital signature and perform a similar mathematical operation on the received message's hash. If the calculated result matches the signature, it indicates that the transaction was signed by the private key's owner, confirming its authenticity.
     
  • Hashing: A hash function takes an input (or message) and produces a fixed-size string of characters, which is the hash. The hash serves as a unique representation of the original message.
     
  • Algorithm parameters: The signature algorithm defines the specific mathematical algorithms and parameters used for key generation, signing, and verification.

Standard algorithms include RSA (Rivest-Shamir-Adleman), DSA (Digital Signature Algorithm), ECDSA (Elliptic Curve Digital Signature Algorithm), and EdDSA (Edwards-curve Digital Signature Algorithm.

The cryptographic signature algorithm used in blockchain transactions depends on the specific blockchain. If the Tangem cards cannot support the network's signature algorithm, we can't integrate that network.

What are the network's nodes/services APIs? 

Nodes and APIs (Application Programming Interfaces) are critical in maintaining the network, validating transactions, and allowing external apps to interact with the blockchain network.

Having public nodes or service APIs from developers — particularly common in EVM networks — is a promising sign. This accessibility often allows users to connect with decentralized wallets. Additionally, the process is easier when our premium node providers, such as GetBlock, already offer these nodes/APIs.

However, the integration becomes more complicated when we need to subscribe to a new service or build our own nodes. To ensure reliability, we engage at least two different node providers for each network, mitigating potential challenges associated with relying on a single source.

The combination of nodes and APIs ensures that the network functions properly and is accessible. Nodes maintain the integrity of the distributed ledger, while APIs help developers build apps that leverage the blockchain's capabilities.

Does the network maintain proper documentation? 

Major blockchain networks and tokens publish comprehensive documentation to help developers, users, and node operators understand and interact with them effectively. Documentation provides adequate info on the API, consensus mechanism, smart contracts, node configuration, security guidelines, and upgrade and migration.

The labor requirements from our dev team depend on this step. Unfortunately, blockchain technology is relatively new, and there aren't just enough technical professionals who are good at creating documentation for every Web3 project. 

We often encounter a common documentation challenge — typically created for users and smart contract developers — where the details of hash generation for signing or API interaction are either omitted or inadequately explained. As a result, Tangem developers must spend time studying the code of existing implementations.

Are there any suitable SDKs and libraries? 

A Software Development Kit (SDK) is a set of software development tools that allow developers to create apps for a specific software package, hardware platform, computer system, or operating system. 

An SDK includes libraries, documentation, sample code, and sometimes additional tools like debuggers or emulators.

The Tangem app is a native app — developed for one particular operating system (e.g., iOS or Android) only — so SDKs from most developers are not often available.

Even JavaScript SDKs — built for multiplatform applications — are not often suited for cold wallets, as the signature function requires a private key to be fed into it. As you know, the private key is generated and stored in the Tangem Wallet's chip and never leaves it.

But there is still hope if such an SDK is in a suitable programming language. We can always refine it by taking pieces of code from there or using separate encoding functions—for example, calculation/validation of the address. In the latter case, suitable libraries can also help, but it still takes a lot of time.

A library is a collection of pre-written code, routines, procedures, and functions that other programs can use.

Does the blockchain network have any unique features? 

Some networks might have uncommon attributes — having reserves or needing to specify MEMO when sending funds — that will require changing the Tangem app's UI/UX before integration is complete.

Sometimes, a network can have very complicated mechanisms for charging commissions. Tangem must set up clear communication lines for our dev and support teams. We will also involve a design team to tweak the UI according to our style guidelines. These procedures affect labor costs and take quite some time.

Part II - Integrating the blockchain network 

After analyzing and approving the requested network or token, our team of developers starts the integration process in the following steps.

1. Finding a suitable API  

Having found a suitable API, we check if we can get the data necessary for creating a transaction. This involves creating a data structure that encapsulates the transaction details, adding digital signatures for authentication, and adhering to the specific format and rules dictated by the blockchain protocol. 

2. Encoding the address from the public key

Encoding the address from the public key means transforming a public key into a more human-readable and manageable format known as an address. In Bitcoin, the address is represented in Base58 encoding; in Ethereum, it's in hexadecimal format. The steps and algorithms for encoding addresses can vary between blockchain networks — each network may have its standards for address encoding.

 3. Obtaining the necessary data from the API and sending a transaction

In addition to receiving transactions that have already been investigated, we also integrate a request to send a transaction. The data needed is the balance, and then specific to the blockchain: UTXO, nonce, the hash of the fresh block, and whether the recipient's account has been created. For successful transactions, our system relies on acquiring essential data and paying careful attention to these key parameters:

  • Balance: the amount of cryptocurrency or funds available in a user's account. Checking the balance ensures that the user has sufficient funds to initiate transactions.
     
  • UTXO (Unspent Transaction Output): the remaining cryptocurrency from previous transactions that a user can spend in a new transaction.
     
  • Nonce: a unique number assigned to each transaction. It helps maintain the chronological order of transactions and prevents replay attacks.
     
  • The hash of the fresh block: The hash of the most recent block in the blockchain creates a link between a current transaction and the overall history of the blockchain, making it tamper-resistant.
     
  • Recipient account status: Verifying whether the recipient's account has been created ensures that the funds are directed to a valid and active account. This step prevents the risk of sending funds to non-existent or inactive accounts.

4. Assembling a transaction

Transaction assembly refers to putting together the necessary components and information to create a complete transaction that can be executed on the blockchain. This process involves collecting and organizing data such as transaction details, recipient information, fees, and any other relevant parameters. Transaction assembly varies by blockchains, but let's describe a general scheme: 

  • We collect an unsigned transaction from the data received from the API and the data entered by the user (recipient's address, amount, fees, etc).
     
  • We calculate the hash/hashes to sign this transaction and send it to the Tangem card.
     
  • Signatures are returned from the card, and we add them to the transaction. We encode the transaction with signatures for sending via the API.

Topping up an account in the testnet and sending transactions

We top up the account in the testnet and attempt to send transactions. Initial attempts often fail, and the intriguing part unfolds when the transaction is rejected, citing "wrong signature algorithm" without providing specific details. 

To troubleshoot this issue, we often compare the unsuccessful transaction with intermediate results in functional solutions, sometimes going into a byte-by-byte analysis.

After successfully sending a transaction, we finalize the calculation of fees. It's worth noting that we often set a fixed fee during initial attempts.

The final stage involves addressing various features and edge cases. This includes handling additional transaction parameters, exploring scenarios such as sending to an empty account (which may require a distinct transaction structure, often involving a prerequisite operation to create the account), dealing with reserves, etc.

Afterward, the design team adds a visual representation of the network or token in the app's backend.

Part III — Testing and launching an app update containing the new network

This long integration process culminates with testing the new app update, ensuring that all recent developments are examined for accurate performance. Here's a brief overview of the testing phase.

Unit testing
We conduct thorough unit testing to verify that individual components of the Tangem app, especially those related to the new blockchain integration, function correctly in isolation.

Integration testing
We check how well the wallet communicates with the blockchain, signs transactions, and handles data specific to the integrated network. We ensure that the Tangem app update — containing the newly integrated blockchain network — functions appropriately on Android and iOS platforms. We also perform security testing to identify and address any vulnerabilities related to the integration.

User Acceptance Testing (UAT)
When the app update includes major features of the new network, we conduct UAT with a select group of users or a testing team to gather feedback on the user experience and identify any issues we may have missed in earlier testing phases.

Bug fixing and deployment to app stores
We address and fix bugs, issues, or feedback received during testing. Then, our development, marketing, and support teams prepare for the official launch. We deploy the updated Tangem app to the respective app stores (Google Play Store for Android and Apple App Store for iOS), where you can download and use the app.

Monitoring and support
We monitor the app's performance post-launch and are prepared to address any issues that may arise. Our support team provides timely support to users and addresses their inquiries related to the integration.

Final thoughts

We're thrilled to share an insight into how we integrate networks and tokens into our wallet, focusing on ensuring your asset's security and a user-friendly experience.

Tangem Wallet now supports over 30 blockchain networks and thousands of coins and tokens. This number keeps rising every month as our development and support teams grow. We've put a lot of thought into our integration strategy, not just considering technical details but also spotlighting accessibility.

We're also working on exciting features like staking and an enhanced cross-chain swap functionality via our aggregator — Tangem Express.

Our 2024 roadmap will highlight several blockchain networks and tokens we plan to integrate in the first quarter of next year. If your desired token/network is not on this map, you can join our social media channels and make a request.

Thank you for choosing Tangem Wallet to manage and store your crypto assets. Stay secure!