Running a Validator

Visit the JBC Node repository: https://github.com/jibchain-net/node

PLEASE USE NORMAL `USER` NOT `ROOT`

How to run a validator node

  1. Clone JBC Node on your node machine:

cd ~
git clone https://github.com/jibchain-net/node.git jbc-node
cd jbc-node
  1. Check node file

ls -la

Example:

total 64
drwxr-xr-x  14 user  staff   448 Dec  3 16:37 .
drwxr-xr-x   4 user  staff   128 Dec  3 16:05 ..
-rw-r--r--   1 user  staff   682 Dec  3 16:07 .env.example
drwxr-xr-x  14 user  staff   448 Dec  3 16:20 .git
-rw-r--r--   1 user  staff     9 Dec  3 16:08 .gitignore
-rw-r--r--   1 user  staff   581 Dec  3 16:17 Makefile
-rw-r--r--   1 user  staff   569 Dec  3 16:05 README.md
drwxr-xr-x  11 user  staff   352 Dec  3 16:05 config
-rw-r--r--   1 user  staff  1518 Dec  3 16:05 docker-compose.yaml
-rw-r--r--   1 user  staff  1121 Dec  3 16:05 genesis.json
-rwxr-xr-x   1 user  staff   216 Dec  3 16:05 init-script.sh
drwxr-xr-x   4 user  staff   128 Dec  3 16:11 keys
-rw-r--r--   1 user  staff   466 Dec  3 16:19 validator.yaml
  1. Create an Environment file with:

make env
  1. Edit .env file

  • VALIDATOR NODE: Edit on the VALIDATOR Configuration section only

    • NODE_GRAFFITI: use your node's graffiti flag to include a short text in the blocks that your node creates

    • PUBLIC_BEACON_NODE : If you're running a full node change to your beacon node.

    • FEE_RECIPIENT : Input your JBC address to receive transaction fees

  • FULL NODE: Edit BOOTNODE Configuration too

    • NODE_PUBLIC_IP : your machine's public IP address (IPv4)

## BOOTNODE Configuration
NETWORK_ID=8899
EXECUTION_BOOTNODES=enode://74f719d76fbced15a34164de149815cb3dd3404153ca3759dae442f835b570920bdc60759693b466df2be8307d7e30715662605995c2c96c2259bac1d9a31967@65.108.126.254:32324
BOOTNODE_ENR=enr:-MS4QDTd7LbtmtvUhbLWbHZ4o2jWmfMl-5hfgHpCh4Arl1NIWGY3bt8ztKJIV3uTEeWf_xRbRy9ASoK7dCtYGam4yZEQh2F0dG5ldHOIAAAAAAAAAACEZXRoMpAY_TCCQACImf__________gmlkgnY0gmlwhEFsfv6EcXVpY4IjjYlzZWNwMjU2azGhAtJJHhhHUQ_QDG-IIXIH-VeIB5ELxroUrHf8D7s5_CsliHN5bmNuZXRzAIN0Y3CCI4yDdWRwgiOM
TARGET_PEERS=1
NODE_PUBLIC_IP=xx.xx.xx.xxx

## VALIDATOR Configuration
NODE_GRAFFITI=JBCValidatorClient
PUBLIC_BEACON_NODE="http://119.59.123.101:5002/"
FEE_RECIPIENT=0x00000000000
  1. Create keystore file

From Generate Validator Keys section. You will receive a key pair

total 16
drwxr-xr-x  4 user  staff  128 Dec  3 15:14 .
drwxr-xr-x  3 user  staff   96 Dec  3 15:14 ..
-r--r-----  1 user  staff  702 Dec  3 15:14 deposit_data-1701591267.json
-r--r-----  1 user  staff  710 Dec  3 15:14 keystore-m_12381_3600_0_0_0-1701591267.json

Copy keystore-m_<timestamp>.json to folder keys

Example:

  1. Import validator key

make import-validator-key

Example:

docker run -ti --rm -v ./data/lighthouse:/root/lighthouse -v ./data/lighthouse/custom/validators:/root/.lighthouse/custom/validators -v ./config:/config -v ./keys:/keys sigp/lighthouse lighthouse account validator import --directory=/keys --testnet-dir=/config
Running account manager for custom (/config) network
validator-dir path: "/root/.lighthouse/custom/validators"
WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

Keystore found at "/keys/keystore-m_12381_3600_0_0_0-1701591267.json":

 - Public key: 0x92d768771c062137e7433fd27072330b14b75d94379432098916ea145d648d2aa84daa448fce166a943315e2644068b6
 - UUID: 96bcdd0c-e0ef-48c2-8bff-7930965c86aa

If you enter the password it will be stored as plain-text in validator_definitions.yml so that it is not required each time the validator client starts.

Enter the keystore password, or press enter to omit it:

INPUT YOUR VALIDATOR KEY PASSWORD

If a password is correct and imported successfully will be shown:

Password is correct.

Successfully imported keystore.
Successfully updated validator_definitions.yml.

Successfully imported 1 validators (0 skipped).

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED.

If you have more than 1 key store. you will input a password equal number of Keystore

  1. The system will create a folder data

ls -la data/lighthouse/custom/validators/

Example:

total 64
drwxr-xr-x  5 user  staff    160 Dec  3 16:49 .
drwxr-xr-x  3 user  staff     96 Dec  3 16:48 ..
drwxr-xr-x  3 user  staff     96 Dec  3 16:49 0x92d768771c062137e7433fd27072330b14b75d94379432098916ea145d648d2aa84daa448fce166a943315e2644068b6
-rw-------  1 user  staff  28672 Dec  3 16:49 slashing_protection.sqlite
-rw-------  1 user  staff    425 Dec  3 16:49 validator_definitions.yml

You will see your validator public key that you imported!

  1. Run a Validator node

make run-validator

Example:

docker compose -f validator.yaml up -d
[+] Running 2/2
 ✔ Network node_default     Created
 ✔ Container jbc-validator  Started
  1. Check a validator logs

make validator-logs
docker compose -f validator.yaml logs
jbc-validator  | Dec 03 09:55:50.134 INFO Logging to file                         path: "/root/.lighthouse/custom/validators/logs/validator.log"
jbc-validator  | Dec 03 09:55:50.134 INFO Lighthouse started                      version: Lighthouse/v4.5.0-441fc16
jbc-validator  | Dec 03 09:55:50.134 INFO Configured for network                  name: custom (/config)
jbc-validator  | Dec 03 09:55:50.135 INFO Starting validator client               validator_dir: "/root/.lighthouse/custom/validators", beacon_nodes: ["http://119.59.123.101:5002/"]
jbc-validator  | Dec 03 09:55:50.135 INFO HTTP metrics server is disabled
jbc-validator  | Dec 03 09:55:50.150 INFO Completed validator discovery           new_validators: 0
jbc-validator  | Dec 03 09:55:50.739 INFO Enabled validator                       voting_pubkey: 0x92d768771c062137e7433fd27072330b14b75d94379432098916ea145d648d2aa84daa448fce166a943315e2644068b6, signing_method: local_keystore
jbc-validator  | Dec 03 09:55:51.352 INFO Modified key_cache saved successfully
jbc-validator  | Dec 03 09:55:51.353 INFO Initialized validators                  enabled: 1, disabled: 0
jbc-validator  | Dec 03 09:55:51.399 INFO Initialized beacon node connections     available: 1, total: 1
jbc-validator  | Dec 03 09:55:51.409 INFO Loaded validator keypair store          voting_validators: 1
jbc-validator  | Dec 03 09:55:51.409 INFO Pruning slashing protection DB          msg: pruning may take several minutes the first time it runs, epoch: 1142
jbc-validator  | Dec 03 09:55:51.409 INFO Completed pruning of slashing protection DB
jbc-validator  | Dec 03 09:55:51.418 INFO HTTP API server is disabled
jbc-validator  | Dec 03 09:55:51.418 INFO Genesis has already occurred            seconds_ago: 438700
jbc-validator  | Dec 03 09:55:51.418 INFO Block production service started        service: block
jbc-validator  | Dec 03 09:55:51.418 INFO Attestation production service started  next_update_millis: 7581, service: attestation
jbc-validator  | Dec 03 09:55:51.418 INFO Sync committee service started          next_update_millis: 7581, service: sync_committee
jbc-validator  | Dec 03 09:55:51.418 INFO Validator registration service started  service: preparation
jbc-validator  | Dec 03 09:55:51.418 INFO Proposer preparation service started    service: preparation
jbc-validator  | Dec 03 09:55:51.418 INFO Doppelganger protection disabled.
jbc-validator  | Dec 03 09:56:05.000 INFO Connected to beacon node(s)             synced: 1, available: 1, total: 1, service: notifier
jbc-validator  | Dec 03 09:56:05.000 INFO Awaiting activation                     slot: 36559, epoch: 1142, validators: 1, service: notifier
jbc-validator  | Dec 03 09:56:17.003 INFO Connected to beacon node(s)             synced: 1, available: 1, total: 1, service: notifier
jbc-validator  | Dec 03 09:56:17.003 INFO Awaiting activation                     slot: 36560, epoch: 1142, validators: 1, service: notifier

Await validator activation and have fun!!

  1. Stop validator

make stop-validator