Running a Consensus Node

System Requirement

If you're planning to run a consensus miner, it's important to make sure your system meets the recommended requirements to ensure that your miner performs at its best.

Resource
Specification

Recommended OS

Ubuntu_x64 20.04 or higher

CPU Processor Num

≥ 4

Memory

≥ 16 GB

Bandwidth

≥ 5 Mbps

Public Network IP

required

Linux Kernel Version

5.11 or higher

Prepare Stash Account

  • Stash Account: This is the account where you keep all the funds you want to stake. This account requires at least 3,000,000 TCESS for staking it can be either from the node owner itself or delegated by other users.

You can also refer to the page Creating CESS Accounts for creating a CESS account.

You can either use CESS testnet faucet to get TCESS, or contact us to receive TCESS tokens for staking.

Binding Funds to Stash Account

Open CESS Explorer and Select Network > Staking > Accounts > Stash

Add a Stash

Select the appropriate stash account from the drop-down menu and enter at least 3,000,000 TCESS in value bounded field. In payment destination, select Stash Account as the reward receiving account (do not increase the amount at stake), which means that mining income will not be automatically added to the stake.

Bond Fund

Click Bond -> Sign and Submit to link the Stash Account.

Sign and Submit

Fund is bonded successfully!

Bonded Fund Successfully

Run a chain node

Run with nodeadm

Install nodeadm

Please purge all of previous data before running a CESS consensus node on machine if an old version consensus node was installed.

    cess purge
    cess uninstall

The cess-nodeadm is a CESS node deployment and management tool. It helps to deploy and manage storage nodes, consensus nodes, and rpc node, simplifying the devOps for all CESS miners.

wget https://github.com/CESSProject/cess-nodeadm/archive/refs/tags/v0.6.1.tar.gz
tar -xvf v0.6.1.tar.gz
cd cess-nodeadm-0.6.1
sudo ./install.sh

You can verify that you are running the latest version of cess-nodeadm here.

On successful installation of cess-nodeadm you will see Install cess nodeadm success message.

If the installation fails, please check the troubleshooting procedures.

Configure nodeadm

Please run the following command to configure nodeadm.

  • set mode with validator

  • set a custom node name cess or any other name of your choice.

$ cess config set

Enter cess node mode from 'tee/storage/validator/rpcnode' (current: validator, press enter to skip): validator
Enter cess node name (current: cess, press enter to skip): cess
Set configurations successfully
Start generate configurations and docker compose file
debug: Loading config file: config.yaml
info: Generating configurations done
info: Generating docker compose file done
e9e3df60a011799587e59f73e22db60d95c2ec7eebfe3058c358ed2d7c6d04a0
Configurations generated at: /opt/cess/nodeadm/build

$ cess start
[+] Running 3/3
 ✔ Container chain       Started
 ✔ Container miner       Started
 ✔ Container watchtower  Started

Run with container

  1. Environment Setup Requirements

    curl -fsSL https://get.docker.com | bash
    docker --version
    docker pull cesslab/cess-chain:testnet
  2. Running Command

    Make sure that port 30336 and 9944 are not occupied by other processes.

    mkdir -p /opt/cess/validator
    
    docker run --rm -v /opt/cess/validator:/opt/cess/data cesslab/cess-chain:testnet key generate-node-key --base-path /opt/cess/data --chain cess-testnet >/dev/null 2>&1
    
    docker run -d \
    --name testnet-rpc \
    -v /opt/cess/validator:/opt/cess/data \
    -p 30336:30336 \
    -p 9944:9944 \
    cesslab/cess-chain:testnet \
    --base-path /opt/cess/data \
    --chain cess-testnet \
    --port 30336 \
    --rpc-port 9944 \
    --rpc-external \
    --execution WASM \
    --wasm-execution compiled \
    --in-peers 75 \
    --out-peers 75 \
    --state-pruning archive \
    --validator \
    --max-runtime-instances 32 \
    --rpc-cors all \
    --prometheus-external \
    --wasm-runtime-overrides /opt/cess/wasms \
    --rpc-methods unsafe

Run with systemd

Download source files

Get the latest release and wasms from Github

mkidr -p /opt/cess/validator
cd /opt/cess/validator
wget https://github.com/CESSProject/cess/releases/download/cess-v0.7.9-venus/cess-node-v0.9.0-Ubuntu -O cess-node
wget https://github.com/CESSProject/cess/releases/download/cess-v0.7.9-venus/wasm_overrides.tar -O wasm_overrides.tar
tar -xvf wasm_overrides.tar
mv .wasm_overrides/testnet/ ./wasms
mv ./wasms /opt/cess/

Get the source files from a local container

rm -rf /opt/cess/chain-tmp && mkdir -p /opt/cess/chain-tmp
docker pull cesslab/cess-chain:testnet
docker run -d --name chain-tmp -p 30337:30336 -p 9945:9944 -v /opt/cess/chain-tmp:/opt/cess/data cesslab/cess-chain:testnet --base-path /opt/cess/data --chain cess-testnet --port 30336 --name cess --rpc-port 9944 --rpc-external --execution WASM --wasm-execution compiled --in-peers 75 --out-peers 75 --state-pruning archive --rpc-cors all --prometheus-external --wasm-runtime-overrides /opt/cess/wasms

docker cp chain-tmp:/opt/cess/cess-node /opt/cess/validator/cess-node
docker cp chain-tmp:/opt/cess/.wasm_overrides/testnet /opt/cess/wasms
docker stop chain-tmp && docker rm chain-tmp

Run as systemd service

mkdir -p /opt/cess/validator

/opt/cess/validator/cess-node key generate-node-key --base-path /opt/cess/validator --chain cess-testnet >/dev/null 2>&1

cat > /lib/systemd/system/validator.service << EOF
[Unit]
Description=CESS-TESTNET-Validator
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/cess/validator/cess-node --base-path /opt/cess/validator --chain cess-testnet --port 30336 --rpc-port 9944 --prometheus-external --name cess-testnet --validator --max-runtime-instances 32 --state-pruning archive --wasm-runtime-overrides /opt/cess/wasms --rpc-methods unsafe 
WorkingDirectory=/opt/cess/validator
StandardOutput=append:/opt/cess/validator/validator.log
StandardError=append:/opt/cess/validator/validator.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF

systemctl enable logrotate.timer
systemctl restart logrotate.timer

cat > /etc/logrotate.d/validator << EOF
/opt/cess/validator/validator.log {
    daily
    rotate 7
    missingok
    notifempty
    compress
    delaycompress
    copytruncate
    create 0644 root root
}
EOF

sudo logrotate -d /opt/cess/validator/validator.log

systemctl enable validator
systemctl restart validator
systemctl status validator
tail -f /opt/cess/validator/validator.log

Become a Validator

  1. Start the chain node

Make sure that the chain node is running normally before proceeding.

$ ps -efww | grep cess-node
  1. Generate a session key

    # generate by nodeadm
    cess tools rotate-keys
    
    # generate by docker
    docker exec chain curl -H 'Content-Type: application/json' -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944 2>/dev/null
    
    # generate by http request
    curl -H 'Content-Type: application/json' -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944 2>/dev/null
    rotate-keys Output Example
  2. Set up a session key

    Navigate to CESS Explorer, choose Network > Staking > Accounts > Session Key

    Session Key 01

    Fill in the Session Key in the red box

    Session Key 02

    Click Sign and Submit

    Session Key 03
  3. Becoming a validator

    Navigate to CESS Explorer, click Network > Staking > Accounts > Validate

    Validator 01
    Validator 02

    Enter 100 in reward commission percentage, indicating that the reward will not be distributed to others.

    Select No, block all nominations in allows new nominations dropdown, indicating that no nominations will be accepted.

    Again, click Sign and Submit.

    Validator 03

    After completing the steps above, open the CESS Explorer and click Network > Staking > Waiting.

    Validator 04

    You should see that the node has already appeared on the candidate node list.

Redeeming Rewards

Navigate to CESS Explorer: Network > Staking > Payouts > Payout.

Redemption: First Step

In Payouts, click Payout to initiate a payment. Any account can initiate a payment.

Redemption: Second Step

Please claim the reward within 84 era (each era of the test network is 6 hours), which is 21 days. Those who hasn't claimed the reward in this period will not be able to claim it.

Exiting Consensus from Validation

  1. Stop the Consensus

    In CESS Explorer, navigate to: Network > Staking > Account Actions > Stop.

    Exiting-01
  2. Clear Session Keys

    In CESS Explorer, navigate to: Developer -> Submission

    Exiting-02

    Enter controller account in using the selected account controller. Then in submit the following extrinsic, enter session and choose purgeKeys() in the box next to it.

    Exiting-03

    Click Submit Transaction button to clear session keys

    Exiting-04

Redeeming Stake

  1. Unbond fund

    After 28 eras (each era of the test network is 6 hours), goto CESS Explorer, navigate to: Network > Staking > Account Actions > Unbond Funds.

    Staking 01
  2. Stop the CESS client

    cess stop

Upgrade CESS Nodeadm Client

Stop and Remove All Services

cess stop
cess down

Remove All Chain Data

cess purge

Update cess-nodeadm

wget https://github.com/CESSProject/cess-nodeadm/archive/refs/tags/<new-version>.tar.gz
tar -xvf <new-version>.tar.gz
cd cess-nodeadm-<new-version>
./install.sh --skip-dep --retain-config  --no-rmi

Pull Images

cess pullimg

Last updated

Was this helpful?