BIFROST Network
  • Introduction
  • Bifrost Network Architecture
    • Consensus
    • Cross-Chain Communication Protocol (CCCP)
    • Oracle Service
  • Running a Node
    • Basic-Node Requirements
    • Full-Node Requirements
    • Validator Account Management
    • Guide for Operators
      • Setting up an Endpoint Node
        • Using Docker
        • Using Systemd
      • Setting up a Validator Node
        • Using Docker
        • Using Systemd
      • Setting up a Relayer
        • bifrost-relayer.rs
        • bifrost-relayer.py (Deprecated)
      • Chain Data Snapshots
      • Trouble Shooting
        • Testnet Chain Sync Issue
    • System Monitoring
      • Prometheus and Grafana
      • Sentry
  • Nominators
  • Developer Documentations
    • Ethereum API
      • Ethereum Precompiled Contracts
      • Libraries
      • Developer Environments
    • Bifrost Precompiled Contracts
      • Staking
      • Governance
      • RelayManager
    • Pallet Interfaces
      • BfcStaking
      • BfcUtility
      • BfcOffences
      • RelayManager
    • Client API
      • JSON-RPC API
        • author
        • chain
        • childstate
        • debug
        • eth
        • grandpa
        • net
        • offchain
        • payment
        • rpc
        • state
        • system
        • trace
        • txpool
        • web3
      • Explorer API
      • Runtime API
    • Cross-Chain Transaction and Oracle API
      • Price Oracle Contract API
      • Socket Contract API
    • Testnet Faucet
  • Governance
  • Security
  • Tokens & Assets
    • Unified Token
    • Inflation Model
  • Add Network
    • Pockie
    • MetaMask
  • Bridge
    • Bridge Guide
      • Depositing to the Bifrost Network
      • Withdrawing to another network
    • Glossary
  • Staking
    • Staking Guide
      • Stake BFC
      • Unstake BFC
    • Glossary
      • All Validators
      • My Staking Status
  • Language
    • 바이프로스트 네트워크 가이드
Powered by GitBook
On this page
  • Install Requirements
  • Generate Peer Key
  • Run the Node Service
  • Check Logs
  • Update Node Client
  1. Running a Node
  2. Guide for Operators
  3. Setting up an Endpoint Node

Using Systemd

PreviousUsing DockerNextSetting up a Validator Node

Last updated 2 months ago

Install Requirements

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.

adduser BIFROST_SERVICE --system --no-create-home

Next, create a local directory to store the chain data of the Bifrost Network. This directory contains the node binary and block information collected from the genesis block to the present.

# Add sudo at the beginning if it doesn't work (i.e. Permission Denied)
mkdir -p /var/lib/bifrost-data

Then, download the latest node execution binary and chain specification JSON file from our Github releases. You can check the latest releases by going to our GitHub repository under the page.

wget "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"
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-mainnet.json"

At last, grant an execution permission to the node binary and move it to your chain data directory.

chmod +x bifrost-node
mv bifrost-node bifrost-testnet.json /var/lib/bifrost-data
chmod +x bifrost-node
mv bifrost-node bifrost-mainnet.json /var/lib/bifrost-data

Generate Peer Key

This section is only required for node client versions that are higher than or equal to v2.0.1

Every node running on the Bifrost Network requires a peer key to connect to the P2P network. To generate a new peer key and insert it into your chain data automatically, simply run the following command.

# Add sudo at the beginning if it doesn't work (i.e. Permission Denied)
/var/lib/bifrost-data/bifrost-node key generate-node-key \
    --chain /var/lib/bifrost-data/bifrost-testnet.json \
    --base-path /var/lib/bifrost-data
/var/lib/bifrost-data/bifrost-node key generate-node-key \
    --chain /var/lib/bifrost-data/bifrost-mainnet.json \
    --base-path /var/lib/bifrost-data

Run the Node Service

First, set ownership permission to your chain data directory to the service account.

chown -R BIFROST_SERVICE /var/lib/bifrost-data

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.

sudo vi /etc/systemd/system/bifrost-node.service
[Unit]
Description="Bifrost-node systemd service"
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=BIFROST_SERVICE
SyslogIdentifier=bifrost-node
SyslogFacility=local7
KillSignal=SIGHUP
ExecStart=/var/lib/bifrost-data/bifrost-node \
    --base-path /var/lib/bifrost-data \
    --chain /var/lib/bifrost-data/bifrost-testnet.json \
    --port 30333 \
    --rpc-port 9933 \
    --state-pruning archive \
    --rpc-cors all \
    --rpc-external \
    --ethapi debug,trace,txpool \
    --runtime-cache-size 64 \
    --name "YOUR_NODE_NAME"

[Install]
WantedBy=multi-user.target
[Unit]
Description="Bifrost-node systemd service"
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=BIFROST_SERVICE
SyslogIdentifier=bifrost-node
SyslogFacility=local7
KillSignal=SIGHUP
ExecStart=/var/lib/bifrost-data/bifrost-node \
    --base-path /var/lib/bifrost-data \
    --chain /var/lib/bifrost-data/bifrost-mainnet.json \
    --port 30333 \
    --rpc-port 9933 \
    --state-pruning archive \
    --rpc-cors all \
    --rpc-external \
    --ethapi debug,trace,txpool \
    --runtime-cache-size 64 \
    --name "YOUR_NODE_NAME"

[Install]
WantedBy=multi-user.target

Conversely, to run an endpoint node with non-archive mode enabled, it is necessary to determine the maximum number of past blocks to be indexed, and the number of blocks may be specified after the --state-pruning option.

Now, with the two lines of the command below, the node service will run in the background.

systemctl enable bifrost-node.service
systemctl start bifrost-node.service

Check Logs

To check your running bifrost-node service logs, execute the command below.

journalctl -f -u bifrost-node

If the node service has successfully been executed, the chain information will be shown as the following.

2023-07-19 17:02:53 BIFROST Network
2023-07-19 17:02:53 ✌️  version 1.2.3-0d1811a5e80
2023-07-19 17:02:53 ❤️  by bifrost-platform, 2022-2023
2023-07-19 17:02:53 📋 Chain specification: BIFROST Development
2023-07-19 17:02:53 🏷  Node name: jolly-grandfather-7771
2023-07-19 17:02:53 👤 Role: AUTHORITY
2023-07-19 17:02:53 💾 Database: RocksDb at /var/folders/vg/xzyl_nmd77x5kcvbryssc5gm0000gn/T/substrateutNaBp/chains/dev/db/full
2023-07-19 17:02:53 ⛓  Native runtime: thebifrost-dev-301 (bifrost-dev-1.tx1.au1)
2023-07-19 17:02:53 🔨 Initializing Genesis block/state (state: 0x7c59…74e5, header-hash: 0x469c…993b)
2023-07-19 17:02:53 🔨 Running Frontier DB migration from version 1 to version 2. Please wait.
2023-07-19 17:02:53 ✔️ Successful Frontier DB migration from version 1 to version 2 (0 entries).
2023-07-19 17:02:53 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2023-07-19 17:02:54 Using default protocol ID "sup" because none is configured in the chain specs
2023-07-19 17:02:54 🏷  Local node identity is: 12D3KooWLvfoahrVYuwGjvNKyyWgkWSvBT9TofHvNGdiexgS3hRL
2023-07-19 17:02:54 💻 Operating system: macos
2023-07-19 17:02:54 💻 CPU architecture: aarch64
2023-07-19 17:02:54 📦 Highest known block at #0
2023-07-19 17:02:54 〽️ Prometheus exporter started at 127.0.0.1:9615
2023-07-19 17:02:54 Running JSON-RPC HTTP server: addr=127.0.0.1:9933, allowed origins=["*"]
2023-07-19 17:02:54 Running JSON-RPC WS server: addr=127.0.0.1:9944, allowed origins=["*"]

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.

2023-07-19 17:06:20 ⚙️  Syncing, target=#8037656 (2 peers), best: #4371 (0xd39a…4f76), finalized #4200 (0x79ee…2eec), ⬇ 485.5kiB/s ⬆ 38.0kiB/s
2023-07-19 17:06:25 ⚙️  Syncing 745.8 bps, target=#8037658 (3 peers), best: #8100 (0xac9e…cba6), finalized #7800 (0xb93d…839f), ⬇ 334.1kiB/s ⬆ 24.0kiB/s
2023-07-19 17:06:30 ⚙️  Syncing 676.0 bps, target=#8037660 (3 peers), best: #11480 (0xbdbf…85f2), finalized #11400 (0x612b…7853), ⬇ 409.8kiB/s ⬆ 23.4kiB/s
2023-07-19 17:06:35 ⚙️  Syncing 596.8 bps, target=#8037661 (3 peers), best: #14465 (0xcce8…aadb), finalized #14400 (0x8f77…7e6b), ⬇ 356.1kiB/s ⬆ 24.5kiB/s
2023-07-19 17:06:40 ⚙️  Syncing 646.8 bps, target=#8037663 (3 peers), best: #17700 (0xf0a1…36d6), finalized #17408 (0x467b…63bf), ⬇ 372.7kiB/s ⬆ 9.2kiB/s
2023-07-19 17:06:45 ⚙️  Syncing 596.4 bps, target=#8037665 (3 peers), best: #20682 (0xcc4c…2ca9), finalized #20480 (0x1d99…7288), ⬇ 340.3kiB/s ⬆ 12.3kiB/s
2023-07-19 17:06:50 ⚙️  Syncing 560.2 bps, target=#8037666 (3 peers), best: #23485 (0x83ba…6fae), finalized #23400 (0xa031…a7e0), ⬇ 399.4kiB/s ⬆ 9.9kiB/s
2023-07-19 17:06:55 ⚙️  Syncing 575.0 bps, target=#8037668 (3 peers), best: #26362 (0xb11c…7fc4), finalized #26112 (0xbaa5…6c61), ⬇ 328.7kiB/s ⬆ 12.8kiB/s
2023-07-19 17:07:00 ⚙️  Syncing 579.4 bps, target=#8037670 (3 peers), best: #29259 (0xa287…cf05), finalized #29184 (0x7ac8…55cb), ⬇ 353.6kiB/s ⬆ 7.8kiB/s
2023-07-19 17:07:05 ⚙️  Syncing 595.4 bps, target=#8037671 (3 peers), best: #32237 (0xfc62…6b12), finalized #32100 (0x95cd…0c27), ⬇ 338.3kiB/s ⬆ 14.9kiB/s
2023-07-19 17:07:10 ⚙️  Syncing 590.2 bps, target=#8037673 (3 peers), best: #35191 (0x3b06…9e27), finalized #35100 (0xd461…5ab7), ⬇ 330.9kiB/s ⬆ 8.7kiB/s

When the chain data is completely synchronized, newly generated blocks will start to synchronize one by one at every block time as follows.

2023-07-19 08:08:09 ✨ Imported #5384451 (0xd7a8…011f)    
2023-07-19 08:08:10 💤 Idle (25 peers), best: #5384451 (0xd7a8…011f), finalized #5384449 (0x1ae1…fdf3), ⬇ 47.7kiB/s ⬆ 49.5kiB/s    
2023-07-19 08:08:12 ✨ Imported #5384452 (0x9bf4…9710)    
2023-07-19 08:08:15 ✨ Imported #5384453 (0x90af…653a)    
2023-07-19 08:08:15 💤 Idle (25 peers), best: #5384453 (0x90af…653a), finalized #5384450 (0x8026…f68a), ⬇ 37.3kiB/s ⬆ 36.9kiB/s    
2023-07-19 08:08:18 ✨ Imported #5384454 (0x5c80…9b84)    
2023-07-19 08:08:20 💤 Idle (25 peers), best: #5384454 (0x5c80…9b84), finalized #5384452 (0x9bf4…9710), ⬇ 38.0kiB/s ⬆ 46.4kiB/s    
2023-07-19 08:08:21 ✨ Imported #5384455 (0x91d0…de42)    
2023-07-19 08:08:24 ✨ Imported #5384456 (0xb7e0…832e)    
2023-07-19 08:08:25 💤 Idle (25 peers), best: #5384456 (0xb7e0…832e), finalized #5384454 (0x5c80…9b84), ⬇ 46.2kiB/s ⬆ 44.2kiB/s    
2023-07-19 08:08:27 ✨ Imported #5384457 (0xcc84…0e00)    
2023-07-19 08:08:30 ✨ Imported #5384458 (0xc499…2475)    
2023-07-19 08:08:30 💤 Idle (25 peers), best: #5384458 (0xc499…2475), finalized #5384455 (0x91d0…de42), ⬇ 28.5kiB/s ⬆ 44.0kiB/s    

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 binary
systemctl stop bifrost-node.service
rm /var/lib/bifrost-data/bifrost-node

# Download the latest bifrost-node binary
wget "https://github.com/bifrost-platform/bifrost-node/releases/latest/download/bifrost-node"

# Grant execute permission & move to chain data directory
chmod +x bifrost-node
chown BIFROST_SERVICE bifrost-node
mv bifrost-node /var/lib/bifrost-data

systemctl restart bifrost-node.service

To quickly synchronize your chain data, follow this .

releases
link