Bytom Cross-chain Technology

BytomDAO
4 min readSep 19, 2019

--

With the official launch of Bystack main-side chain architecture, the cross-chain issue between mainchain and sidechain has been the major problem for Bytom team. Now Bytom has adopted two mechanisms for the cross-chain issue.

Bytom Cross-chain types

The cross-chain models of Bytom adopt Notary Scheme and Hash-locking.

There are no assets on sidechain Vapor so that we use the Notary Scheme to transfer assets from mainchain to sidechain. Meanwhile, Notary Scheme needs time to sign and confirm so we use hash-locking to accelerate the transfer of the assets.

Notary Scheme

If you have participated in Bystack BP voting, you won’t be strange about cross-chain of Bytom. You can realize one-click cross-chain in Bycoin wallet.

So what’s the principle behind the Notary Scheme? Let’s ignore the technical details, the core point is the value generation and burn, interface communication between asset custody and the main-side chain.

When you transfer assets from mainchain to sidechain, you need to create corresponding assets on sidechain; Vice Versa, you need to burn corresponding assets on sidechain if you want to transfer your assets from sidechain to mainchain, these are the generation and destruction of value. While cross-chain from mainchain to sidechain The assets of the main chain need to be in custody. In order to ensure security, we usually adopt multi-sig and separation of large assets.

Validator: BPs of sidechain

Collector: Monitor the transaction in the Federation contract address, collect transactions on mainchain and create equal assets on sidechain, monitor the sidechain cross-chain request, burn the assets on the sidechain and release equal assets on the mainchain.

Federation address: Multi-sig address generated by Federation members’ public key

What if users click cross-chain?

From mainchain to sidechain:

  1. Collector monitors the Federation address of mainchain have received a transfer
  2. Collector waits for pending on the mainchain until the transaction can't be reversed
  3. Collector creates equal assets on the sidechain and confirms it through multi-sig, then transfer to the sidechain addresses of users
  4. Users can acquire assets on sidechain

From sidechain to mainchain:

  1. Collector monitors a transaction to destroy assets
  2. Collector waits for pending on the sidechain
  3. Collector send equal assets from Federation address, confirms it through multi-sig
  4. Users can acquire assets on mainchain

Hash-locking

Hash-locking is a mechanism by which the user guesses the original value of the hash value within a specified period of time. On the basis of the smart contract, both parties lock the asset first, and if both parties input the original value of the correct hash value in a limited time, the transaction can be completed.

Through the Notary Scheme, the assets of Bytom can be transferred to the side chain, and the assets of Bytom and the sidechain can be directly exchanged through the hash time lock.

For example, if you have BTC on the mainchain and I have ETH on the side chain, if I use the Notary Scheme, I need to transfer BTC to the sidechain or the ETH to the mainchain, so that the exchange can be made. With the hash-lock mechanism, you can directly send the assets on my mainchain, and you can send the assets on the sidechain to me, and guarantee the atomicity and safety of the whole process.

Process:

  1. User A wants to exchange the BTC on the mainchain with the ETH of user B on the sidechain
  2. A opens a smart contract on the mainchain and sets up Hash-locking H and a time-locking T. A can get his BTC back beyond the time.
  3. A gives the H to B and B can use the same hash to open a smart contract on the sidechain and set time-locking t.
  4. A and B check their own contract
  5. After confirming the smart contract, A uses the original hash value to unlock the sidechain smart contract of B within t and gets the ETH.
  6. Once A unlocks the smart contract of B, the original hash value will be shown and B gets the original hash value and B can unlock the smart contract of A’s mainchain and get BTC
  7. Assets exchange completed.

The Bystack cross-chain tech is being optimized over and over. We can realize the high-performance of sidechain and circulate the different types of assets on the sidechain.

--

--

BytomDAO
BytomDAO

No responses yet