BIFROST Network
Search
⌃K

Using Docker

Installation Instructions

All types of BIFROST Network nodes can be run easily through Docker. Docker must be pre-installed in the environment you wish to run the nodes. Once installed, you can proceed with the following process.
First, create a local directory to store the chain data of the BIFROST Network. The directory stores all block information collected from genesis blocks to the present and additional session keys of the corresponding validator node.
# Add sudo at the beginning if it doesn't work
mkdir -p /var/lib/bifrost-data
You must set the ownership and permissions for the directory you created. If you wish to set it to a specific user, you can run the command written in “case 1” and change DOCKER_USER to the actual user name to run Docker later. If you want to set it as the currently connected user, you can run the command written in "case 2".
# case 1. chown to a specific user
chown DOCKER_USER /var/lib/bifrost-data
# case 2. chown to current user
sudo chown -R $(id -u):$(id -g) /var/lib/bifrost-data
To run the validator node, you can simply run the following command. In this case, YOUR_NODE_NAME is a parameter indicating the name of the node to be executed and should be modified to the desired name.
Testnet
Mainnet
docker run -d --network host -v "/var/lib/bifrost-data:/data" --name "YOUR_CONTAINER_NAME" thebifrost/bifrost-node:latest \
--base-path /data \
--chain /specs/bifrost-testnet.json \
--port 30333 \
--validator \
--state-pruning archive \
--trie-cache-size 0 \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"
docker run -d --network host -v "/var/lib/bifrost-data:/data" --name "YOUR_CONTAINER_NAME" thebifrost/bifrost-node:latest \
--base-path /data \
--chain /specs/bifrost-mainnet.json \
--port 30333 \
--validator \
--state-pruning archive \
--trie-cache-size 0 \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"
If the Docker image is successfully pulled, and the validator node is executed, the chain information will be shown as the following.
Since chain data needs to be synced starting from the genesis block, the information that it is currently syncing will be shown as the following output. You can proceed to the next steps only when the sync is complete, and it may take up to several days at most.
When all the chain data sync is complete, newly generated blocks are synchronized one by one at every block time as follows.
We now proceed with the key setting that is required to allow the validator node to perform the process of block generation and finalization. From this step, the chain data sync of the running node must be completed.
First, validator nodes essentially require two Ethereum-style accounts, the controller and stash accounts, and in the case of the full node, an additional relayer account.
A stash account is an account that holds a certain amount of self-bond that must be deposited in the system so that the delegated account can act as a validator. The role of a stash account is to deposit self-bonds and delegate one account (controller) to perform validator activities publicly on its behalf.
The controller account is the target of the delegation from the stash account and is the account that acts as a validator. The role of the controller is an account that is dedicated to all activities such as session key registration, block generation, finalization, etc., and requires minimal assets to pay transaction fees.
If you need to create a new account, you can run the following commands.
# step 1. access your docker container
docker exec -it YOUR_CONTAINER_NAME /bin/bash
# step 2. move to the tools directory
cd tools
# step 3. install required packages
npm install
# step 4. generate validator accounts
# case 1. generate accounts for basic nodes
npm run create_accounts
# case 2. generate accounts for full nodes
npm run create_accounts -- --full
After executing the command, the available new validator accounts will be printed as follows. You must send enough BFC to each account that meets the requirements to proceed to the next process.
Next, the validator node must issue and register session keys to be used in the consensus algorithm. The process can be performed by executing the following command. Make sure that you are in the tools directory.
npm run set_session_keys -- \
--controllerPrivate "YOUR_CONTROLLER_PRIVATE_KEY"
This command will generate three session keys for your node. Each key has their own purpose. Aura is for block creation, grandpa is for block finalization, and ImOnline is for node liveness. The generated keys will be stored in your chain data directory. The directory path will look like this: /var/lib/bifrost-data/chains/mainnet/keystore.
Finally, it is necessary to deposit the self-bonds of the validator node to form the initial voting power. The process can be performed by executing the following command.
# case 1. join as a basic node
npm run join_validators -- \
--controllerPrivate "YOUR_CONTROLLER_PRIVATE_KEY" \
--stashPrivate "YOUR_STASH_PRIVATE_KEY" \
--bond "YOUR_SELF_BOND_AMOUNT_IN_BFC"
# case 2. join as a full node
npm run join_validators -- \
--controllerPrivate "YOUR_CONTROLLER_PRIVATE_KEY" \
--stashPrivate "YOUR_STASH_PRIVATE_KEY" \
--relayerPrivate "YOUR_RELAYER_PRIVATE_KEY" \
--bond "YOUR_SELF_BOND_AMOUNT_IN_BFC"
If you have successfully completed all processes above, the amount of BFC deposited from the stash account will be deducted from the wallet, and your controller account will participate in the active validator update process in the next round. You can check whether or not you successfully joined the validator pool on the following page.
If the tier of the validator node to be operated is a full node, it must be operated with the relayer. The manual for relayer setup can be found in the "Setting up a relayer" section.

Update Node Client

As BIFROST Network development continues, it will sometimes be necessary to upgrade your node client. Node operators will be notified on our Discord channel or by personal contacts when upgrades are available and whether they are necessary (some client upgrades are optional).
Before upgrading your node client, please keep a backup file of your chain data to prevent any further data, keys, or credential losses.
Testnet
Mainnet
# First of all stop bifrost-node
docker stop "YOUR_CONTAINER_NAME"
docker rm "YOUR_CONTAINER_NAME"
# Pull the latest bifrost-node image
docker pull thebifrost/bifrost-node:latest
# Change bifrost-node version on run command
# e.g.
docker run -d --network host -v "/var/lib/bifrost-data:/data" --name "YOUR_CONTAINER_NAME" thebifrost/bifrost-node:latest \
--base-path /data \
--chain /specs/bifrost-testnet.json \
--port 30333 \
--validator \
--state-pruning archive \
--trie-cache-size 0 \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"
# First of all stop bifrost-node
docker stop "YOUR_CONTAINER_NAME"
docker rm "YOUR_CONTAINER_NAME"
# Pull the latest bifrost-node image
docker pull thebifrost/bifrost-node:latest
# Change bifrost-node version on run command
# e.g.
docker run -d --network host -v "/var/lib/bifrost-data:/data" --name "YOUR_CONTAINER_NAME" thebifrost/bifrost-node:latest \
--base-path /data \
--chain /specs/bifrost-mainnet.json \
--port 30333 \
--validator \
--state-pruning archive \
--trie-cache-size 0 \
--runtime-cache-size 64 \
--name "YOUR_NODE_NAME"