Cross-Chain Value Transfer
This section will explain how to enable ERC-20 value transfer between Baobab network and your service chain with the provided test code. You will add KLAY to the operator account and deploy bridge and ERC-20 contracts. Then you will register the contract address on SCN. And you will test an ERC-20 value transferring.
Prerequisites
We assume that you installed the service chain, and connected the service chain to the Baobab EN (link).
Download the code for contract deployment and transfer. (download)
Install
Node.js
(v10.60.0) andnpm
(How to install)
ERC-20 Token Transfer
Step 1: Add KLAY to the operator accounts.
Connect to the SCN and check the account addresses by executing subbridge.parentOperator
and subbridge.childOperator
.
Create a test account on a Baobab Wallet and get test KLAY from the faucet. Then send 1 KLAY to the parentOperator
. childOperator
has to get KLAY from the test account generated by homi
(Refer to EN Setup and SCN Connection Guide).
Check if the operator accounts have enough balance.
Step 2: Deploy Contracts
Connect to the SCN and prepare the node environment for contract deployment. Download deploy_and_test.tar.gz
and extract it to node_project directory.
On a text editor, edit the deploy_conf.json
as below.
Replace
ip
andport
in thescn
section with the actual values of your SCN. The port is RPC_PORT in kscnd.conf. The default configuration is using port 7551.Replace
key
withtestkey1
that was generated byhomi
.Set
operator
to thesubbridge.childOperator
address that we examined in the previous step.Replace
ip
andport
in theen
section with the actual values of your EN. The port is RPC_PORT in kend.conf. The default configuration is using port 8551.Replace
key
with the private key of the test account created from Baobab Wallet in the previous stepSet
operator
as thesubbridge.parentOperator
of the previous step.
Perform token deployment with node deploy.js
command. It will show an API list to perform at the next step.
Step 3: Register Bridge, Subscribe Bridge and Register Token
On the console, execute the APIs shown above one by one.
Step 4: Token transfer
Perform token transfer with node transfer.js
command.
Check if the result is alice balance: 100
.
Last updated