Skip to main content

Deploy the token bridge contract on BSC Testnet

This topic outlines how to deploy the token bridge contract on the BSC Testnet. The token bridge enables ERC20 tokens to be transferred between Chromia and Binance Smart Chain.

Prerequisites

Before starting, ensure you have the following tools and resources:

Step 1: Retrieve node’s EVM address

First, obtain the EVM address associated with your Chromia node’s public key. Run the following command, replacing YOUR_NODE_PUBLIC_KEY with your actual Chromia node's public key:

chr repl -c 'crypto.eth_pubkey_to_address(x"YOUR_NODE_PUBLIC_KEY")'

For example:

chr repl -c 'crypto.eth_pubkey_to_address(x"0324653EAC434488002CC06BBFB7F10FE18991E35F9FE4302DBEA6D2353DC0AB1C")'

This will output the address in hexadecimal format:

x"17C5185167401ED00CF5F5B2FC97D9BBFDB7D025"

Next, set the NODE_EVM_ADDRESS environment variable:

export NODE_EVM_ADDRESS=17C5185167401ED00CF5F5B2FC97D9BBFDB7D025

Step 2: Deploy the contract to BSC Testnet

To deploy the contract to the BSC Testnet, use the following command:

yarn deploy --network bsc_testnet --app $NODE_EVM_ADDRESS --offset 2
  • --network bsc_testnet: Specifies the BSC Testnet as the target for deployment.
  • --app $NODE_EVM_ADDRESS: Deploys the contract using the EVM address obtained in Step 1.
  • --offset 2: Sets an offset value for the deployment process.

Upon successful deployment, the terminal will display the addresses of the deployed contracts. For example:

Validator deployed to:  0x01cd3172AA7b70beb6476E72DA509EfE00CD652D
Token bridge deployed to: 0x7EE9dfbDF18c609a5e1AB0180c8A2ec6D473E093
Proxy admin address is: 0x5Ea833bbE9A8afb4381338650DA14497D3728b75
tip

Make sure to copy and save the deployed contract addresses for future reference.