Set up the Chromia token bridge
In this topic, you'll go through setting up a Chromia token bridge for the Ethereum Goerli Testnet, along with configuring a Chromia single validator node using Chromia CLI. Follow these steps carefully to set up the token bridge successfully.
Before you begin, ensure you have the following:
- Chromia CLI 0.10.0 or a compatible version installed.
- Access to the Ethereum Goerli Testnet.
- Knowledge of your Chromia validator node's public key (e.g.,
0350fe40766bc0ce8d08b3f5b810e49a8352fdd458606bd5fafe5acdcdc8ff3f57) or use the chr keygen to generate a validator node key pair.
- Knowledge of the equivalent EVM address (e.g.,
0xCaf200436270A60Cda6543602F2Ea4224E31351d). You can convert a Chromia public key to an EVM address using an online tool.
Step 1: Deploy smart contract on Ethereum Goerli Testnet
Start by deploying a smart contract on the Ethereum Goerli Testnet. In this example, we use a Chromia single validator node's EVM address with the
–app option. Replace
0xCaf200436270A60Cda6543602F2Ea4224E31351d with your validator node's EVM address.
yarn deploy --network goerli --verify –app 0xCaf200436270A60Cda6543602F2Ea4224E31351d
Verify the successful deployment of the smart contract on Etherscan and make a note of the contract address (e.g.,
0x2426F34a96a8437A2E3fDE9fE2e6100fCb96495C) for later use.
Step 2: Set up the Chromia node for the token bridge
Chromia CLI includes the postchain-eif-core module, simplifying the setup of the Chromia node for the token bridge support. Follow these steps:
- Set up a Rell development environment on your local machine.
- Clone the sample node from the repository.
chromia.yml and node config:
- Update the contract address to your deployed smart contract address (e.g.,
- Set the skip to height to match the block number when you deployed the smart contract (e.g.,
- Prepare the node config. You only need to configure the
goerli.urlkey in the node config to point to your Ethereum Goerli JSON RPC endpoint. You can use third-party RPC node services like Infura or Alchemy for testing.
Install and start the Chromia node with token bridge support:
chr node start --node-properties config/node-config.properties --wipe
You must specify the full path to
node-config.properties to override the node properties file. Refer to the node command for more details.
Step 3: Obtain the Blockchain RID
After your Chromia node is up and running, find the Blockchain RID in the node's output. This unique identifier is essential for interacting with your dapp in the following steps. The Blockchain RID is a hexadecimal value following the
Blockchain RID: tag (e.g.,
Step 4: Interact with the Chromia token bridge using the sample UI
To interact with the Chromia token bridge, follow these steps:
- Utilize the sample UI for the token bridge.
- Modify the keys in the
.envconfiguration file of the UI with the following:
- Rebuild and start the UI:
yarn install && yarn build
yarn global add serve
serve -s build
http://localhost:3000/ to use the dapp for interacting with the Chromia token bridge.
Step 5: Allow user access
For users to utilize the Chromia token bridge, administrators must set up the following:
- Allow tokens to be deposited on the smart contract.
- Register assets on Chromia to be used as pegged tokens.
- Register EVM tokens on the Chromia chain.
- Map the pegged tokens and EVM tokens on the Chromia chain.
Additionally, users should create their own Chromia FT accounts to use the Chromia token bridge.