How TomoBridge works under the hood?

TomoChain Publisher
TomoChain
Published in
9 min readMay 20, 2020

This article explains the current implementation of TomoBridge — the cross-chain transfer module for interoperability between TomoChain and other crypto assets chains, along with its future development plans.

Why TomoBridge?

Interoperability between different blockchains has been one of the most important concerns in the cryptocurrency industry. It brings out the ability to move crypto assets back-and-forth between different public blockchains.

TomoBridge plays an important role in the TomoChain ecosystem where DeFi applications have been the top focus.

  • TomoBridge allows users to transfer their crypto assets from the Bitcoin and Ethereum blockchains (the current blockchains supported by TomoBridge) to trade on TomoX relayers, thus increasing liquidity of TomoX. Once transferred, the owner of a transferred crypto asset will receive a corresponding amount of wrapped token for the transferred crypto asset. Wrapped tokens are issued on TomoChain to represent the original tokens. This ensures that users will have a smooth experience on TomoX despite the big gap of block time and transaction speed between TomoChain and other blockchains.
  • An owner of any assets can use wrapped tokens in the TomoLending P2P lending that can be enabled by any relayer. Advanced features of TomoLending compared to other lending applications could also be used to generate passive income for swapping users.

More use-cases for wrapped tokens are described later in this article.

Design considerations

There are several directions for cross-chain transfer technology in the market.

Centralization

In a centralized cross-chain transfer protocol, users send their original crypto assets to a single entity, which will be managed in a centralized way.

  • Pros: Easy to use and implement / Simple & quick withdrawals / Affordable Cost / Applicable for most blockchains.
  • Cons: Centralization nature could be a risk to crypto-assets security

Extreme decentralization

Decentralizing the entire management of the transferred crypto assets is considered as trustless protocols.

  • Pros: No single entity manages the original crypto assets. Hacking the system is as hard as hacking a system of thousands of machines.
  • Cons: This approach, unfortunately, has several limitations:
  1. Cost: Expensive as lots of people need to be involved in the original management process. Furthermore, the more entities involved in the process, the more transaction fees the owner of the crypto assets need to pay the involving entities for making the process run smoothly. On Ethereum, each confirmed Transaction would cost roughly 0.09$. If we multiply this with, for example, 1000 entities that need to confirm transactions, the cost would be 90$ for every user every time they want to transfer wrapped tokens from TomoChain back to Ethereum. This problem also applies to Bitcoin.
  2. Indefinite Delay: Every transfer-back transaction needs to be approved by all (or the majority of) involving entities, which could be off-line during the transfer-back transaction creation. This, in turn, causes users to wait for an indeterministic amount of time.
  3. Safety and security: The current state-of-the-art techniques for decentralized cross-chain transfer are not fully proven to be safe and secure. What this means is that users could be caught in a trap that locks their crypto assets due to, for example, a technical problem during implementation or in the used cross-chain transfer technologies itself.
  4. Implementation hardness: The implementation and deployment of such decentralization system are very hard as it takes a very long time to complete and testing to assess the safety and security of the implemented protocols.
  5. Scalability: Blockchain technology is still in its early and immature stage where different blockchains use different protocols. There is no unified interface for the interaction and communication between different blockchains. This makes all decentralized cross-chain technologies dependent upon the technologies and interfaces developed by the communicating blockchains. For example, interoperability between TomoChain and Ethereum is much easier to do than interoperability between TomoChain and Bitcoin.

Practical decentralization

Based on our diligent observations on various cross-chain technologies, TomoChain decided to implement a cross-chain transfer technique that lies in between the above design considerations. The design decision has been made with care for user experience, cost, implementation, and maintenance hardness.

Specifically, TomoBridge allows a limited set of involving entities, namely validators, to process the management of transferred crypto assets in a decentralized way.

The validators set can scale up to 50 for acceptable transaction fees.

All crypto assets are locked in smart contracts on Ethereum or multi-signature wallets on Bitcoin. The unlocking process is only made if there is a successful request of a user who owns the corresponding wrapped token.

When there is an unlock request, all involving entities will communicate with each other to reach an agreement to confirm the unlock request and transfer the original crypto assets back to users.

The set of validators can be changed based on the TomoChain governance system. Specifically, once the voting governance for TomoChain becomes active, all masternodes and stakers could vote for which entities to become validators in TomoBridge.

One of our considerations was to make all masternodes become validators in TomoBridge. However, not all nodes are online 100% all of the time. Some masternodes could be slashed, some could be pushed out of the top 150, or even some are just off-line for an indefinite amount of time due to various reasons such as electricity or network problems. All of those reasons could make the validator set to change every 30 minutes (one epoch), which would need to be updated to the asset management smart contracts or multi-signature wallets. Updating the validator set too frequently makes the cost for only updating unacceptably high.

This design brings us some advantages as follows:

  1. Not extremely hard to implement. This allows us to release TomoBridge along with TomoX, which is very important for TomoChain ecosystem including DEXs powered by TomoX and DeFi applications. Today, the majority of trading volume takes place on centralized exchanges with major coins like BTC, USDT and ETH. TomoBridge changes that, bringing liquidity to DEXs on TomoChain and making it possible to trade many digital assets.
  2. Relatively decentralized: The validator set would be changed periodically based on the vote on the governance, but the change period will be longer than 30 minutes. It would normally take 2 weeks or so in order to maintain the stability of TomoBridge and to ensure smooth user experience.
  3. Scalable/applied to majority of blockchains: Multi-signature and smart contracts are the basics in most blockchains. Only depending on those basic techniques allows TomoBridge to adapt to any crypto-asset on any public blockchain.
  4. Cost: The cost for a transfer-back transaction will be acceptable for every user as the number of validators is not extremely high.
  5. Fast transfer-back: The transfer-back process will be very fast as the validators are stable.
  6. Safety and Security: As all validators will be geographically located in different regions of the world, the chance to hack the system remains negligible. Furthermore, as the validators are very stable, safety could be much better than unproven decentralized cross-chain techniques in edge cases.

How TomoBridge works

In charge of interoperability between mainstream blockchains and TomoChain, TomoBridge simple works:

  • Lock original assets in the original chains and mint a corresponding amount of TRC21 Wrapped Tokens on TomoChain if and only if there is a successful process swapping from an original access and this process must be validated by a set of multi-signature validators that maintain a certain level of decentralization.
  • Unlock original assets AND BURN A CORRESPONDING AMOUNT OF THE corresponding TRC21 WRAPPED TOKEN ON TOMOCHAIN if and only if there is a successful process swapping back from TRC21 wrapped tokens on TomoChain and this process must be validated by a set of multi-signature validators that maintain a certain level of decentralization.

All is to maintain a 1–1 peg between the original assets and the corresponding TRC21 wrapped tokens.

Swapping from other chains to TRC21-based wrapped tokens

  • The user who shall swap an amount of an original asset for the corresponding TRC21 wrapped token on TomoChain needs to interact with TomoBridge.
  • The process is atomic in the sense that, at the end of the process, the user doing the swap either should have the corresponding TRC21-based wrapped tokens, or their original assets stay with them.
  • Through the TomoBridge website, a user must lock their original assets in a multi-signature secure wallet.
  • The multi-signature is secure and scalable up to 50 validators that keep the assets locked and only unlock it if there is a successful process swapping from TRC21 wrapped tokens to the original assets.
  • All these validators run on servers that are geographically located in different continentals of the world to ensure a certain decentralization level to secure the multi-signature wallet.
  • The user must log in TomoBridge using either TomoWallet or any third-party wallets that support TOMO.
  • For BTC, a multi-signature wallet address shall be derived using BIP32 standard for Bitcoin. For ETH and USDT, a multi-signature wallet smart contract is deployed on Ethereum network to lock ETH and tokens on Ethereum. The user will make a simple transaction to those multi-signature wallets on the corresponding blockchain that has the wrapping crypto asset to lock their swapping crypto asset in.
  • The address of the wallet that logs in TomoBridge shall be the address for receiving TRC21 wrapped tokens.
  • Once completed, the user shall receive the corresponding TRC21 wrapped token with an amount corresponding to the amount the user has locked in the multi-signature wallet.
  • The user shall use the TRC21 wrapped token to trade on any TomoX Relayer that lists the TRC21 wrapped token.

At the current development phase, BTC, ETH, and USDT are supported by TomoBridge and any Relayer Owner can choose to list the corresponding TRC21 wrapped tokens.

Besides the ability to trade on TomoX, wrapping these original assets into TRC21 tokens bring immense benefits for the holders of those assets and the TomoChain ecosystem in general.

  • Transfer your TRC21 wrapped assets without the need of holding TOMO in your wallet. This brings a great advantage compared to another interoperability system, i.e. to send WBTC on Ethereum, users still need to hold ETH.
  • Wrapped tokens could be used as collateral assets in TomoLending — the pure P2P Lending application that can be enabled by any relayer.
  • Very fast payments using TomoChain as the platform to process transactions that use those TRC21 wrapped tokens as payment units.
  • Wrapped tokens can be sent and received privately using TomoP — TomoChain privacy transaction protocol that protects individual financial privacy while still providing the fastest transaction speed (confirmed within 2–4s) and the great user experience compared to existing privacy coin solutions.
  • With the use of TomoP and wrapped tokens, any user could erase entirely their trading history by sending the wrapped tokens privately to a newly generated address and continuing to trade using that new address.
  • Wrapped tokens can be used for staking to earn passive enough in some Dapps on TomoChain.
  • Wrapped tokens can be potentially used in games that are being built on TomoChain by several teams.

Unwrap: Swapping from TRC21-based tokens for original crypto assets

  • The user who shall un-swap an amount of TRC21 wrapped tokens for the original assets needs to interact with TomoBridge.
  • The unwrapping process is atomic in the sense that, at the end of the process, the user should either receive the original crypto asset with an amount corresponding to the unwrapping amount, or the user still possesses the wrapped token for trading on TomoX.
  • The user must log in TomoBridge using either TomoWallet or any third-party wallets that support TOMO.
  • The user must then transfer the TRC21 wrapped token to TomoBridge’s address.
  • After the transaction to TomoBridge has enough 30 confirmations on TomoChain, TomoBridge shall take a small un-wrapping fee that serves as transaction fees for all multi-signature validators to reach a consensus. Once the consensus between all validators is reached, a transaction shall be made and signed by all validators in order to unlock the corresponding original asset to the user.

Roadmap

The current implementation of TomoBridge supports mainstream crypto assets, including BTC, ETH, and USDT (ERC20). The choice of these tokens is based on their liquidity on all cryptocurrency exchanges.

In the future, once TomoX becomes more mature, and when the demand for trading other tokens increases, TomoBridge will be upgraded to support those tokens. Possible support would be for DAI, LINK, EOS, XRP…

We are also in a way of designing the integration of multi-signature wallets upgrades into the governance of TomoChain system, that allows masternodes to vote on a various design decision.

Follow us on TomoChain Announcement Channel | Twitter | Facebook | LinkedIn | Reddit | Github | Sign up for our newsletter on Website

For General support: TomoChain Chat

For Technical support: Gitter

--

--