1) AMB contracts deployment

Create accounts for deployment

1) Generate private keys for the following using MetaMask or MyEtherWallet. Save as json keystore file + password. Note the json location, wallet address, and password for each account.
    DEPLOYMENT_ACCOUNT
    FOREIGN_BRIDGE_OWNER
    FOREIGN_VALIDATORS_OWNER
    FOREIGN_UPGRADEABLE_ADMIN
    HOME_BRIDGE_OWNER
    HOME_VALIDATORS_OWNER
    HOME_UPGRADEABLE_ADMIN
    VALIDATOR
This data can not be recovered through an account after creation, so be sure to store accurately and safely.
You will need tokens for deployment on both sides of the bridge. This means the DEPLOYMENT_ACCOUNT and VALIDATOR accounts will require tokens. The DEPLOYMENT_ACCOUNT will deploy bridge contracts and initialize the bridge, and VALIDATOR accounts use tokens to pay for txs with bridge operations.

Configure and Deploy Bridge Contracts

1) Create configuration file amb.config

Replace all variables templated with tags (<>) with actual values. Learn more about variables here ​
1
BRIDGE_MODE=ARBITRARY_MESSAGE
2
# The private key without 0x part.
3
DEPLOYMENT_ACCOUNT_PRIVATE_KEY=<DEPLOYMENT_ACCOUNT_PRIVATE_KEY>
4
DEPLOYMENT_GAS_LIMIT_EXTRA=0.2
5
HOME_DEPLOYMENT_GAS_PRICE=5000000000
6
FOREIGN_DEPLOYMENT_GAS_PRICE=5000000000
7
GET_RECEIPT_INTERVAL_IN_MILLISECONDS=3000
8
​
9
HOME_RPC_URL=https://<url.to.homenet>
10
HOME_BRIDGE_OWNER=<HOME_BRIDGE_OWNER>
11
HOME_VALIDATORS_OWNER=<HOME_VALIDATORS_OWNER>
12
HOME_UPGRADEABLE_ADMIN=<HOME_UPGRADEABLE_ADMIN>
13
​
14
# The maximum value of gas for one call to be allowed for relaying.
15
HOME_MAX_AMOUNT_PER_TX=2000000
16
HOME_REQUIRED_BLOCK_CONFIRMATIONS=1
17
HOME_GAS_PRICE=5000000000
18
​
19
FOREIGN_RPC_URL=https://<url.to.foreignnet>
20
FOREIGN_BRIDGE_OWNER=<FOREIGN_BRIDGE_OWNER>
21
FOREIGN_VALIDATORS_OWNER=<FOREIGN_VALIDATORS_OWNER>
22
FOREIGN_UPGRADEABLE_ADMIN=<FOREIGN_UPGRADEABLE_ADMIN>
23
​
24
# The maximum value of estimated gas for one transaction in Wei.
25
FOREIGN_MAX_AMOUNT_PER_TX=2000000
26
FOREIGN_REQUIRED_BLOCK_CONFIRMATIONS=1
27
FOREIGN_GAS_PRICE=10000000000
28
​
29
REQUIRED_NUMBER_OF_VALIDATORS=1
30
# If several validators are used, list them separated by space without quotes
31
# E.g. VALIDATORS=0x 0x 0x
32
VALIDATORS=<address of validator>
Copied!
Optional: If you plan to use Etherscan or BlockScout for exploring your chain, find information on the correct parameters to include in the .env file here: https://docs.tokenbridge.net/about-tokenbridge/features/contracts-verification-in-explorers​

2) Deploy Contracts

Deployment of contracts with usage of the docker image is very straightforward:
1
docker run -it --env-file amb.config poanetwork/tokenbridge-contracts deploy.sh
Copied!
After successful deployment the following information about the bridge contracts is displayed:
1
{
2
"homeBridge": {
3
"address": "0xaA19D8ECfB824951AF06fEb5aDeC2423e2eFa608",
4
"deployedBlockNumber": 12794100
5
},
6
"foreignBridge": {
7
"address": "0x5FE5d72992b1c0F4C9a8628E82c960733D2cd85f",
8
"deployedBlockNumber": 16159665
9
}
10
}
Copied!
Last modified 7mo ago