Chains

BNB Smart Chain

Build web3 dApps effortlessly

BNB Beacon Chain

Sunset soon

BNB ecosystem’s staking & governance layer

DocumentationGitHubFaucetStake BNBBscScanBSCTraceDev ToolsLearn more about FusionDocumentationBeacon Chain ExplorerDocumentationGitHubFaucetBridgeGreenfieldScanDCellarDev ToolsDocumentationGitHubFaucetBridgeopBNBScanDev ToolsDocumentationGitHub

Developers


Submit dApps

BNB Smart ChainBNB GreenfieldopBNBzkBNBBNB HackBNB Incubation Alliance (BIA)Most Valuable Builder Accelerator Program (MVB)BNB Chain GrantsKickstartGas GrantsTVL Incentive ProgramMEME Coins InnovationSee All Programs

Ecosystem

Staking

Earn BNB and rewards effortlessly

Tokenization Solutions

Get Your Business Into Web3

Native StakingLiquid StakingCompany TokenizationReal World Assets TokenizationNFT Loyalty Program

Community

Contact UsGet Started
Contact UsGet Started

Open Source Ethereum and Binance Smart Chain Bi-directional bridge Solution

2021.3.30  •  3 min read
Blog post image.

What is BSC-Ethereum Bridge

To enable the value flow between BSC and Ethereum, especially for the tokens not listed on existing cross-chain tools: Binance Bridge, https://multichain.xyz/ or https://www.curvegrid.com/, we propose an open source solution providing access to inter-blockchain liquidity.

Codebase

This is a unique solution to build an application built between Binance Smart Chain and Ethereum. The cross-chain bridge simply serves as a method of bidirectionally transferring ERC20/BEP20 tokens between the Ethereum Network and Binance Smart Chain network in a quick and cost-efficient manner.

The fees for users can be quite low. The Ethereum to BSC transfer will result in the creation of a newly minted token on the BSC blockchain known as BEP20. The user will also have the ability to transfer BEP20 tokens from the BSC network back to the Ethereum Network, which would result in the burning of the BEP20 token and subsequent unlocking of the original ERC20 token on the Ethereum Network.

Bridge Elements

The following graph describes that a new ERC20-to-BEP20 bridge will work like this: the swap service server listens to one of the chains (one side of the bridge) to watch the bridge-related events, performs actions to approve swap requests in from of collecting signatures from the swap proxy contracts and sends tokens to another side of the bridge.

Swap Service

  • The service keeps watching the swap request events on both chains and sends transactions to swap proxy contracts on both chains.
  • The server monitors register events to issue mirrored assets (tokens) on the Binance Smart Chain.

Ethereum chain side:

  • There is a swap contract deployed on Ethereum mainnet
  • the contract receives requests from the server to lock/unlock a number of ERC20 tokens
  • it is possible to collect fees

Binance Smart chain side:

  • There is a swap contract deployed on Binance Smart Chain
  • the contract receives requests from the server to mint/burn a number of ERC20 tokens
  • it is possible to collect fees

Example of user operations

Register ERC20 token to Binance Smart Chain

  1. Alice created an ERC20 token on Ethereum mainnet
  2. Alice called `register` function to create its BEP20 equivalents
  3. Swap service server received `register` event. As result, a BEP20 token will be created on the bsc and the bsc swap contract is the owner of the BEP20 token. It has zero supply

Ethereum to Binance Smart Chain

  1. Bob received some tokens from Alice and he wanted to swap to BEP20
  2. Bob called a method `swapETH2BSC` from ETH swap contract. The arguments of the method `erc20Addr` and `amount`.
  3. Swap service server received `deposit` event and minted the same amount of BEP20 token
  4. The newly minted BEP20 token was sent to Bob on BSC

Binance Smart Chain to Ethereum

  1. Bob wanted to swap back his token to ERC20.
  2. Bob called a method `swapBSC2ETH` from BSC swap contract. The arguments of the method `bep20Addr` and `amount`.
  3. Swap service server received `deposit` event and burned the same amount of BEP20 token
  4. The same amount of ERC20 token was unlocked and sent to Bob on Ethereum

Security

  1. Operations security will be provided by different schemes on different sides of the bridge.
  2. Key management security. It’s very important to keep the private key of the swapof swap server in a safe space.





Share