TON Bridge
Last updated
Last updated
🎯 This document describes the goals and expectations of TON Bridge to the Cosmos Ecosystem. It also outlines the MVP definition of the project as well as providing several top-level designs of the system.
TON Bridge
aims to create a trustless tunnel that allows users to bridge and swap TON tokens to the Cosmos Ecosystem and vice versa in one step.
The system makes sure to validate every transaction using light clients and merkle proofs via decentralized relayers, opening endless possibilities bringing the Cosmos Ecosystem to TON and vice versa.
Anyone can become a relayer who validates transactions and receive relayer fees as a reward.
No known-to-date TON Bridge to the Cosmos Ecosystem.
TON is currently not IBC-compatible.
The current official TON Bridge to and from EVM networks are non-trustless & closed-source
The RSquad team wrote two papers to design a trustless bridge system, but:
The source is outdated, buggy, and not production-ready.
TON → Cosmos Ecosystem:
There’s no Rust or Go library that fully implements the RSquad’s paper.
There’s also no CosmWasm contract that implements the paper.
Cosmos Ecosystem → TON:
No Func contract that implements the trustless system.
The design and implementation must match with the consensus model of Cosmos Ecosystem, not Ethereum.
💡 We need to design and implement a trustless, decentralized, and verifiable system that connects TON with the Cosmos Ecosystem.
Our trustless TON Bridge is heavily influenced by RSquad Blockchain Labs Trustless System
About TON blockchain, recommend to check on our articulated document TON Blockchain 101
Light client concept which is used to verify blocks, validators from both Oraichain and Ton Network is inspired from IBC client standard
Each TON transaction is either included in a shard block or a masterchain block
A shard block reference may or may not be included into a masterchain block.
A masterchain block only includes references to the latest shard blocks within a specific logical time.
The latest shard block will include references to the previous shard blocks so that these blocks are also verifiable.
Example
Each masterchain block is verified by a set of validators (PoS)
Each masterchain keyblock contains the next set of validators within the 2-hour window after a consensus round has finished.
A full block queried from RPC contains:
All kinds of hashes for merkle proof validations from the block header (block hash, app hash,…).
Validator addresses and signatures.
Proof of packet existence based on key store inside state of blockchain at that block.
We can use such data to:
Verify if a packet data is existed at a specific block based on app hash and proof of packet’s existence. (ICS23)**
Verify if a block is valid by validating it against the validator signatures.
With a reported over 700 million monthly active users on Telegram. The evolving of The Open Network (TON) eco-system is undeniable.
The success of top-tier projects like $unibot and $MEVFree (boasting monthly incomes exceeding $5 million, during bear marketing) not only proved high-demand from Telegram users, but also TON eco-system provide a lot success enablers to developers, such as:
TON's Native Payment: with @Wallet
Telegram Community Promotion: de-facto option for Crypto/Blockhain communities
Room for enhancing User Experience: More than Bot + API + Mini App
With rapid growth of TVL of TON (from $71M to $994M in first half of 2024), We (Oraichain Labs) see it a huge potential for DeFi opportunities between Cosmos eco-system & TON eco-system - which currently being limited by official TON Bridge is only support Ethereum & BNB Chain.
Move assets from across eco-systems natively
Allow users on TON eco-system to interact with Cosmos eco-system’s DeFi products
Introduce new liquidity opportunities
Repository | Description |
---|---|
https://github.com/oraichain/tonbridge-relayer | A decentralized middleware server that bridges the TON blockchain to Oraichain/Cosmos blockchains. It is responsible for delivering packets from TON or Oraichain/Cosmos, and can be compared to an IBC relayer. |
https://github.com/oraichain/ton-contracts | Func smart contracts which control Oraichain/Cosmos block validation and transactions, creating a trustless and secure interoperability environment on TON. |
https://github.com/oraichain/tonbridge-cw-contracts | CosmWasm smart contracts. These contracts are in charge of TON's block validation and transaction management, ensuring a trustless and secure interoperability environment on Oraichain/Cosmos. |
https://github.com/oraichain/tonlib-rs | Rust library that interacts with the TON blockchain. It gives developers the tools they need to interface with the TON blockchain through their Rust apps. This library has been improved and refined for usage in the Cosmwasm contract for cell parsing and encoding. |
https://toncenter.orai.io/ | A server similar to the LCD server in the Cosmos environment. It is used to query and execute data on the TON blockchain, giving users a reliable interface for dealing with the blockchain. |
🎯 Follow graphics guideline by TON
From TON → Cosmos
From Cosmos → TON
Sequence diagrams for verifying TON light client
RPC nodes from Cosmos stop running due to network or connection errors.
Memory leaks.
Relayer wallets run out of native coins to pay for the fees.
TON’s lite client or Toncenter fails to return responses due to network or connection errors.
Cannot query proof due to pruned data.
Packet is expired.
No acknowledgement from TON to clean up data.
Cosmos Tx failed but still included in a block.
The Jetton Bridge contract runs out of tokens to unlock to the receiver.
Cosmos Tx timestamp versus current timestamp gap is larger than the trusting period.
Packet is expired.
No acknowledgement from Cosmos to clean up data.
Could not validate and update new validator set.
The bridge contract runs out of tokens to unlock to the receiver.
The block’s validator signatures are not greater than 2/3 of the total voting power.
Cosmos
term mentioned above mean Cosmos-based blockchains or Cosmos ecosystem
IBC specifications
🛠 Built by Oraichain Labs — if you like our tools, please consider delegating to OWallet validators ⚛️
⚠ This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Or plainly spoken - this is a very complex piece of software which targets a bleeding-edge, experimental smart contract runtime. Mistakes happen, and no matter how hard you try and whether you pay someone to audit it, it may eat your tokens, set your printer on fire or startle your cat.
Cryptocurrencies are a high-risk investment, no matter how fancy.