In addition to using the Docker image, there are ways to run nodes with the Linux system daemon as a Systemd service. The service will work on most Linux operating systems. However, Debian/Ubuntu is the only environment in which all tests have been completed, and the manual has been written based on this environment.
First, create a service account to run the node service.
adduserBIFROST_SERVICE--system--no-create-home
Next, create a local directory to store the chain data of the Bifrost Network. This directory will contain the node binary and all block information collected from the genesis block to the present and additional session keys of the corresponding validator node.
# Add sudo at the beginning if it doesn't workmkdir-p/var/lib/bifrost-data
After you download the latest node execution binary and move it to the directory you created earlier, you must set permissions of the binary and ownership of the directory. You can check the latest releases by going to our GitHub repository under the releases page.
# step 1. Download the latest bifrost-node binary & bifrost-testnet.jsonwget"https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"wget"https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-testnet.json"# step 2. Grant execute permission & move to chain data directorychmod+xbifrost-nodemvbifrost-nodebifrost-testnet.json/var/lib/bifrost-data# step 3. Set ownershipchown-RBIFROST_SERVICE/var/lib/bifrost-data
# step 1. Download the latest bifrost-node binary & bifrost-mainnet.jsonwget"https://github.com/bifrost-platform/bifrost-node/releases/download/latest/bifrost-node"wget"https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-mainnet.json"# step 2. Grant execute permission & move to chain data directorychmod+xbifrost-nodemvbifrost-nodebifrost-mainnet.json/var/lib/bifrost-data# step 3. Set ownershipchown-RBIFROST_SERVICE/var/lib/bifrost-data
Run the Node Service
Next, you need to create a Systemd configuration file. In the example below, change YOUR_NODE_NAME to the desired name of your node service, and save the file in the following directory.
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.
To quickly synchronize your chain data, follow this link.
The scripts that we provide to proceed with the remaining detailed setup processes are written in Node.js. Install the required packages and execute the following commands to receive the script.
# step 1. install node.js and npm# skip this step if node.js & npm are already installed on your environmentsudoaptupdatesudoaptinstall-ynodejsnpm# step 2. clone the bifrost node git repositorygitclonehttps://github.com/bifrost-platform/bifrost-node# step 3. install the required packagescdbifrost-node/toolsnpminstall
We now proceed with the key setting required to allow the validator node to perform the process of block generation and finalization. From this step onwards, the chain data synchronization 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 nodes, an additional relayer account is required. The stash account must have enough BFC to deposit as much as the initial self-bond, and the controller account only needs enough balance to pay for some transactions. If you need to create a new account, you can run the following commands. Make sure that you are in the tools directory.
# Generate validator accounts# Case 1. generate accounts for basic nodesnpmruncreate_accounts# Case 2. generate accounts for full nodesnpmruncreate_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.
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/{testnet|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 nodenpmrunjoin_validator_candidates-- \--controllerPrivate"YOUR_CONTROLLER_PRIVATE_KEY" \--stashPrivate"YOUR_STASH_PRIVATE_KEY" \--bond"YOUR_SELF_BOND_AMOUNT_IN_BFC"# case 2. join as a full nodenpmrunjoin_validator_candidates-- \--controllerPrivate"YOUR_CONTROLLER_PRIVATE_KEY" \--stashPrivate"YOUR_STASH_PRIVATE_KEY" \--relayerPrivate"YOUR_RELAYER_PRIVATE_KEY" \--bond"YOUR_SELF_BOND_AMOUNT_IN_BFC"
If all of the above processes have been successfully completed, 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 at 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 below.
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.
# Stop and delete bifrost-node binarysystemctlstopbifrost-node.servicerm/var/lib/bifrost-data/bifrost-node# Download the latest bifrost-node binarywget"https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"# Grant execute permission & move to chain data directorychmod+xbifrost-nodechownBIFROST_SERVICEbifrost-nodemvbifrost-node/var/lib/bifrost-datasystemctlrestartbifrost-node.service