Join the Mainnet
bitsongd init <your_custom_moniker>
Note Monikers can contain only ASCII characters. Using Unicode characters is not supported and renders your node unreachable.
By default, the
init
command creates your ~/.bitsongd
directory with subfolders config
and data
. In the config
directory, the most important files for configuration are app.toml
and config.toml
.You can edit the
moniker
in the ~/.bitsongd/config/config.toml
file:# A custom human readable name for this node
moniker = "<your_custom_moniker>"
For optimized node performance, edit the
~/.bitsongd/config/app.toml
file to enable the anti-spam mechanism and reject incoming transactions with less than the minimum gas prices:# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
###############################################################################
### Base Configuration ###
###############################################################################
# The minimum gas prices a validator is willing to accept for processing a
# transaction. A transaction's fees must meet the minimum of any denomination
# specified in this config (e.g. 0.25token1;0.0001token2).
minimum-gas-prices = "0.0025ubtsg"
Your full node has been initialized!
Fetch the mainnet's
genesis.json
file into bitsongd
's config directory.wget -O ~/.bitsongd/config/genesis.json https://raw.githubusercontent.com/bitsongofficial/networks/master/bitsong-2b/genesis.json
Your node needs to know how to find peers. You'll need to add healthy seed nodes to
$HOME/.bitsongd/config/config.toml
export PEERS="[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:31656,[email protected]:26656,[email protected]:26656,[email protected]:31656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26256,[email protected]:31656,[email protected]:26656,[email protected]:26656,e5428ce29ccd2643[email protected]:26656,[email protected]:26656,2cd6bb75fc92[email protected]:31656"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" ~/.bitsongd/config/config.toml
Now we have to syncronise the node with the current state of the blockchain. The fastest way to achieve this is by using state sync, which we will use for this purpose.
sudo systemctl stop bitsong
SNAP_RPC="https://rpc.bitsong.forbole.com:443"
SNAP_RPC2="https://bitsong.stakesystems.io:2053"
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
peers="[email protected]:26656,[email protected]:26656,[email protected]:16656,[email protected]:26656,[email protected]:31656,[email protected]:26656,[email protected]:26656,[email protected]:31656,[email protected]:26656,[email protected]:26656,[email protected]:26656,2cd6bb75fc92[email protected]:31656"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.bitsongd/config/config.toml
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC2\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.bitsongd/config/config.toml
cp $HOME/.bitsongd/data/priv_validator_state.json $HOME/.bitsongd/priv_validator_state.json.backup
bitsongd tendermint unsafe-reset-all --keep-addr-book --home "$HOME/.bitsongd"
mv $HOME/.bitsongd/priv_validator_state.json.backup $HOME/.bitsongd/data/priv_validator_state.json
sudo systemctl start bitsong
sudo journalctl -u bitsong -f
By default, the REST API is disabled. To enable the REST API, edit the
~/.bitsongd/config/app.toml
file, and set enable
to true
in the [api]
section.###############################################################################
### API Configuration ###
###############################################################################
[api]
# Enable defines if the API server should be enabled.
enable = false
# Swagger defines if swagger documentation should automatically be registered.
swagger = false
# Address defines the API server to listen on.
address = "tcp://0.0.0.0:1317"
Optionally, you can activate swagger by setting
swagger
to true
or change the port of the REST API in the parameter address
. After restarting your application, you can access the REST API on YOURNODEIP:1317
.By default, gRPC is enabled on port
9090
. In the ~/.bitsongd/config/app.toml
file, you can make changes in the gRPC section. To disable the gRPC endpoint, set enable
to false
. To change the port, use the address
parameter.###############################################################################
### gRPC Configuration ###
###############################################################################
[grpc]
# Enable defines if the gRPC server should be enabled.
enable = true
# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9090"
To run the node in a background process with automatic restarts, you can use a service manager like
systemd
. To set this up run the following:sudo tee /etc/systemd/system/bitsongd.service > /dev/null <<EOF
[Unit]
Description=BitSong Network Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which bitsongd) start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
Then setup the daemon
sudo -S systemctl daemon-reload
sudo -S systemctl enable bitsongd
We can then start the process and confirm that it is running
sudo -S systemctl start bitsongd
sudo service bitsongd status
Last modified 7mo ago