Deploy Relays

1. Create configuration files

  • Generate configuration file of BMR from ICON --> Moonriver

cd $PROJECT_DIR/btp
make btpsimple
# Output binaries of `btpsimple` is placed under bin/ directory.
# Add /bin directory to PATH environment variable
export BTPSIMPLE=$PROJECT_DIR/btp/bin
export PATH=$PATH:$BTPSIMPLE
chmod +x ./entrypoint.sh
BTPSIMPLE_CONFIG=$CONFIG_DIR/moon.config.json \
BTPSIMPLE_SRC_ADDRESS=$(cat $CONFIG_DIR/btp.icon) \
BTPSIMPLE_SRC_ENDPOINT=http://127.0.0.1:9080/api/v3/icon \
BTPSIMPLE_DST_ADDRESS=$(cat $CONFIG_DIR/bmc_perif.btp.addr) \
BTPSIMPLE_DST_ENDPOINT=ws://localhost:9944 \
BTPSIMPLE_OFFSET=$(cat $CONFIG_DIR/moon.offset) \
BTPSIMPLE_KEY_STORE=$CONFIG_DIR/moon-bmr.keystore.json \
BTPSIMPLE_KEY_SECRET=$CONFIG_DIR/moon-bmr.secret \
BTPSIMPLE_LOG_WRITER_FILENAME=$CONFIG_DIR/moon-bmr.log \
./entrypoint.sh
  • Generate configuration file of BMR from Moonriver --> ICON

BTPSIMPLE_CONFIG=$CONFIG_DIR/icon.config.json \
BTPSIMPLE_SRC_ADDRESS=$(cat $CONFIG_DIR/bmc_perif.btp.addr) \
BTPSIMPLE_SRC_ENDPOINT=ws://localhost:9944 \
BTPSIMPLE_DST_ADDRESS=$(cat $CONFIG_DIR/btp.icon) \
BTPSIMPLE_DST_ENDPOINT=http://127.0.0.1:9080/api/v3/icon \
BTPSIMPLE_OFFSET=$(cat $CONFIG_DIR/icon.offset) \
BTPSIMPLE_KEY_STORE=$CONFIG_DIR/icon-bmr.keystore.json \
BTPSIMPLE_KEY_SECRET=$CONFIG_DIR/icon-bmr.secret \
BTPSIMPLE_LOG_WRITER_FILENAME=$CONFIG_DIR/icon-bmr.log \
./entrypoint.sh

Add "options": {"stepLimit": 50000000000000} into $CONFIG_DIR/icon.config.json. For Example:

"dst": {
"address": "btp://0x3.icon/cxbcad01c6b50459f0e2110fb90507f30d59f95579",
"endpoint": "http://127.0.0.1:9080/api/v3/icon",
"options": {
"stepLimit": 50000000000000
}
},

2. Start BMRs

Before starting the BMRs, we have to add some "fuels"

  • Adding funds to Moonbeam-BMR

export MOON_BMR=$(cat $CONFIG_DIR/moon-bmr.addr)
cd $PROJECT_DIR/btp/build/contracts/solidity/bmc
truffle exec $SCRIPT_DIR/mb_fund_bmr.js --network moonbeamlocal
  • Add funds to ICON-BMR

cd $PROJECT_DIR/btp
AMOUNT=1000000000000000000000000
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon sendtx transfer \
--to $(cat $CONFIG_DIR/icon-bmr.addr) --value $AMOUNT \
--key_store $CONFIG_DIR/goloop.keystore.json \
--key_password $(cat $CONFIG_DIR/goloop.keysecret) \
--nid $(cat $CONFIG_DIR/nid.icon) \
--step_limit 10000000000
# Check the balance of ICON-BMR
goloop rpc --uri http://127.0.0.1:9080/api/v3/icon balance $(cat $CONFIG_DIR/icon-bmr.addr)

Now, let start the BMRs

  • Start BMR from ICON --> Moonriver

$PROJECT_DIR/btp/bin/btpsimple start --config $CONFIG_DIR/moon.config.json
  • Start BMR from Moonriver --> ICON

$PROJECT_DIR/btp/bin/btpsimple start --config $CONFIG_DIR/icon.config.json