Concept explanation— How to EVM cross-chain? ETH <> BSC & CREATE2Deployer

Blocks Creatorz
2 min readApr 13, 2021

Why cross-chain in the first place?

  • Benefits of each and every chains
  • Being everywhere => increase accessibility

It is also possible to make cross-chain transactions between chains that have not the same funds, such as ETH <> BTC.

Though, in this article, I will only speak about EVM chain based only. If you want to make a BTC <> ETH bridge it’s an all different process using Hashed Time Locked Contract (HTLC) in order to do an atomic swap and sync chains: more here.

CREATE2Deployer, what the heck?

This way of deploying contracts allows you to pre-compute contracts’ addresses. This means on every chain on every chain you will deploy your contract the address will always be the same

You can do this by using, this CREATE2Deployer or the one from OpenZeppelin there.

The bytecode is the compiled code of your contract (in .json file). The salt is a number chosen by you, the deployer.

Let’s dive deep into it

1. Crosschain implementation

As Andre Cronje wrote in this article there are multiple ways to enable cross-chain for your tokens.

  1. Wrapped + Mint/Burn: best according to him
  2. Liquidity swap (balance float + mint/burn): 2nd best according to him
  3. Mint/Burn
  4. Balance float

For more details, read his article.

2. Bridge implementation

Still in the same Andre Cronje’s article, you can see 4 types of bridge you can either use via Thorchain, Anyswap, Multichain, xDai, Matic, Binance and else.

3. Deploy all contracts with CREATE2Deployer

By doing so, it will allow you to have the same contract at the same address no matter which chain you choose. This is great for a better UX: you only need to change the node’s address in your app to interact with the other chain nothing else.

4. You can implement a bridge yourself

If you are using test networks, there are no bridges, at the time of writing, for ETH-testnet <> BSC-testnet. Julien Klepatch has done an amazing tutorial about how to implement a bridge yourself: YouTube tuto and repo link.

5. Potential issue with above bridge code

Julien Klepatch said this tutorial contains issues regarding security & UX, such as:

  • Relying on bridge API private key — centralised: users must trust the private key owner. Either the owner can steal funds or someone else can if the private key is compromised.
  • Bridge costs: in the tutorial made by Julien Klepatch, the bridge pays tx fees. It is possible to update it so users pay it.
  • Transfer order: better to respect the order of transfers because currently the bridge can process them out of order.

That’s all folks! The next article is about tips & tricks for cross-chain development.

--

--

Blocks Creatorz

Etherian unicorn 🦄 sharing his knowledge, inspiration & energy 🔥 Money is a powerful malleable universal energy 🗽