Skip to content

Latest commit

 

History

History
751 lines (586 loc) · 39.8 KB

INSTALL-NODE-UBUNTU-EN.md

File metadata and controls

751 lines (586 loc) · 39.8 KB

Installing the BOSagora Node on Ubuntu on AWS

This document contains instructions for installing a node on a Ubuntu server (EC2) within the Amazon Web Service.
It's also written to help you use it with your video https://youtu.be/VP2QweI9HnM.

1. To create AWS EC2

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Click the Launch Instances button in the upper right corner.
  • Set the name of the instance in Name and tags.
  • Select Ubuntu in the Application and OS Images (Amazon Machine Image).
    • Select Ubuntu Server 22.04 LTS.
  • Select Instance type
    • Select the t3.medium.
  • Click Create new key pair to create a new key pair.
  • Specify a key pair name, set the key pair type and private key file format (RSA, .pem), and click Generate Key Pair to download the key pair file.
  • Click Create security group in Firewall (security groups)
  • Enter the size of the volume to assign to the instance in Configure storage
    • Enter a volume size greater than or equal to 100 GB.
  • Click 'Launch Instance' at the bottom.
  • When the launching of instance is complete, click the button View all instances, and then verify that the instance has been created.

2. To set up a Firewall (security groups)

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to change the firewall.
  • Select the tab Security in the bottom tabs.
  • Click Security Group currently set in EC2.
  • Click the button Edit inbound rules on the right. This switches to the Edit inbound rules screen.
  • Click the button 'Add rule'.
  • Select Type: Custom TCP; Port range : 30303; Source : Anyway IP4 in the newly added rule.
  • Click the button 'Add rule'.
  • Select Type: Custom UDP; Port range : 30303; Source : Anyway IP4 in the newly added rule.
  • Click the button 'Add rule'.
  • Select Type: Custom TCP; Port range : 13000; Source : Anyway IP4 in the newly added rule.
  • Click the button 'Add rule'.
  • Select Type: Custom UDP; Port range : 12000; Source : Anyway IP4 in the newly added rule.
  • Click the button 'Save rules'.

3. To connect to an EC2 instance

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to connect.
  • Click the button Connect in the upper right corner. This will switch to the Connect to instance screen.
  • Click the button Connect in the lower right corner.
  • It is then connected to the EC2 Instance as a terminal.

4. To install Docker Engine

Run the command below to install 'Docker Engine'.

sudo apt update
sudo apt install docker.io -y
sudo apt install docker-compose -y

Include the current account in the docker group so that the docker's commands can be used by accounts other than the root account.

sudo /usr/sbin/groupadd -f docker
sudo /usr/sbin/usermod -aG docker 'ubuntu'
sudo chown ubuntu:docker /var/run/docker.sock

5. To install BOSagora nodes

Connect to the EC2 instance.

Run the command below to download the installation file.

mkdir agora-chain-mainnet
cd agora-chain-mainnet
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/bosagora/agora-chain/v0.x.x/agora.sh)"

6. Running 'agora-el-node'

6.1. To connect using a new terminal

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to connect.
  • Click the button Connect in the upper right corner. This will switch to the Connect to instance screen.
  • Click the button Connect in the lower right corner.
  • It is then connected to the EC2 Instance as a terminal.

6.2. To install 'agora-el-node'

Run the command below to navigate to the installed folder.

cd agora-chain-mainnet

Initialize the settings of the agora-el node by running the command below.

./agora.sh el-node init

The following logs are generated by executing the above command.

INFO [01-17|05:00:03.938] Maximum peer count                       ETH=50 LES=0 total=50
INFO [01-17|05:00:03.947] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [01-17|05:00:03.957] Sanitizing cache to Go's GC limits       provided=1024 updated=645
INFO [01-17|05:00:03.961] Set global gas cap                       cap=50,000,000
INFO [01-17|05:00:03.966] Allocated cache and file handles         database=/root/chain/el/geth/chaindata cache=16.00MiB handles=16
INFO [01-17|05:00:04.001] Opened ancient database                  database=/root/chain/el/geth/chaindata/ancient/chain readonly=false
INFO [01-17|05:00:04.001] Writing custom genesis block 
INFO [01-17|05:00:04.004] Persisted trie from memory database      nodes=1 size=151.00B time=1.530678ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-17|05:00:04.005] Successfully wrote genesis state         database=chaindata                     hash=6743c7..cdb71c
INFO [01-17|05:00:04.005] Allocated cache and file handles         database=/root/chain/el/geth/lightchaindata cache=16.00MiB handles=16
INFO [01-17|05:00:04.030] Opened ancient database                  database=/root/chain/el/geth/lightchaindata/ancient/chain readonly=false
INFO [01-17|05:00:04.030] Writing custom genesis block 
INFO [01-17|05:00:04.033] Persisted trie from memory database      nodes=1 size=151.00B time="984.442µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [01-17|05:00:04.034] Successfully wrote genesis state         database=lightchaindata                     hash=6743c7..cdb71c

6.3. Running 'agora-el-node' to receive all previously created blocks

Run 'agora-el-node' by running the command below.

./agora.sh el-node run

The following logs are generated by executing the above command.

INFO [01-17|05:00:42.211] Starting Agora-el (Agora Execution Layer) client... 
INFO [01-17|05:00:42.212] Bumping default cache on mainnet         provided=1024 updated=4096
INFO [01-17|05:00:42.212] Enabling metrics collection 
INFO [01-17|05:00:42.212] Enabling stand-alone metrics HTTP endpoint address=0.0.0.0:6060
INFO [01-17|05:00:42.212] Starting metrics server                  addr=http://0.0.0.0:6060/debug/metrics
INFO [01-17|05:00:42.216] Maximum peer count                       ETH=50 LES=0 total=50
INFO [01-17|05:00:42.217] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
WARN [01-17|05:00:42.220] Sanitizing cache to Go GC limits       provided=4096 updated=645
INFO [01-17|05:00:42.220] Set global gas cap                       cap=50,000,000
INFO [01-17|05:00:42.222] Allocated trie memory caches             clean=96.00MiB dirty=161.00MiB
INFO [01-17|05:00:42.222] Allocated cache and file handles         database=/root/chain/el/geth/chaindata cache=321.00MiB handles=524,288
INFO [01-17|05:00:42.249] Opened ancient database                  database=/root/chain/el/geth/chaindata/ancient/chain readonly=false
INFO [01-17|05:00:42.250]  
INFO [01-17|05:00:42.250] --------------------------------------------------------------------------------------------------------------------------------------------------------- 
INFO [01-17|05:00:42.250] Chain ID:  2151 (AGORA MAINNET) 
INFO [01-17|05:00:42.250] Consensus: Beacon (proof-of-stake), merging from Clique (proof-of-authority) 
INFO [01-17|05:00:42.250]  
INFO [01-17|05:00:42.250] Pre-Merge hard forks: 
INFO [01-17|05:00:42.250]  - Homestead:                   0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/homestead.md) 
INFO [01-17|05:00:42.250]  - Tangerine Whistle (EIP 150): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/tangerine-whistle.md) 
INFO [01-17|05:00:42.250]  - Spurious Dragon/1 (EIP 155): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md) 
INFO [01-17|05:00:42.250]  - Spurious Dragon/2 (EIP 158): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md) 
INFO [01-17|05:00:42.250]  - Byzantium:                   0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/byzantium.md) 
INFO [01-17|05:00:42.250]  - Constantinople:              0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/constantinople.md) 
INFO [01-17|05:00:42.250]  - Petersburg:                  0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/petersburg.md) 
INFO [01-17|05:00:42.250]  - Istanbul:                    0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/istanbul.md) 
INFO [01-17|05:00:42.251]  - Berlin:                      0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md) 
INFO [01-17|05:00:42.251]  - London:                      0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md) 
INFO [01-17|05:00:42.251]  - Arrow Glacier:               0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md) 
INFO [01-17|05:00:42.251]  - Gray Glacier:                0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md) 
INFO [01-17|05:00:42.251]  
INFO [01-17|05:00:42.251] Merge configured: 
INFO [01-17|05:00:42.251]  - Hard-fork specification:    https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md 
INFO [01-17|05:00:42.251]  - Network known to be merged: false 
INFO [01-17|05:00:42.251]  - Total terminal difficulty:  2411764 
INFO [01-17|05:00:42.251]  - Merge netsplit block:       1375549  
INFO [01-17|05:00:42.251] --------------------------------------------------------------------------------------------------------------------------------------------------------- 
INFO [01-17|05:00:42.251]  
INFO [01-17|05:00:42.251] Initialising Ethereum protocol           network=2151 dbversion=<nil>
INFO [01-17|05:00:42.252] Loaded most recent local header          number=0 hash=6743c7..cdb71c td=1 age=53y9mo3w
INFO [01-17|05:00:42.252] Loaded most recent local full block      number=0 hash=6743c7..cdb71c td=1 age=53y9mo3w
INFO [01-17|05:00:42.252] Loaded most recent local fast block      number=0 hash=6743c7..cdb71c td=1 age=53y9mo3w
WARN [01-17|05:00:42.253] Failed to load snapshot, regenerating    err="missing or corrupted snapshot"
INFO [01-17|05:00:42.253] Rebuilding state snapshot 
INFO [01-17|05:00:42.253] Resuming state snapshot generation       root=b30ae1..8127f9 accounts=0 slots=0 storage=0.00B dangling=0 elapsed="480.848µs"
INFO [01-17|05:00:42.253] Generated state snapshot                 accounts=1 slots=0 storage=50.00B dangling=0 elapsed="819.538µs"
INFO [01-17|05:00:42.254] Regenerated local transaction journal    transactions=0 accounts=0
WARN [01-17|05:00:42.254] Chain pre-merge, sync via PoW (ensure beacon client is ready) 
INFO [01-17|05:00:42.254] Gasprice oracle is ignoring threshold set threshold=2
INFO [01-17|05:00:42.255] Stored checkpoint snapshot to disk       number=0 hash=6743c7..cdb71c
WARN [01-17|05:00:42.255] Error reading unclean shutdown markers   error="leveldb: not found"
WARN [01-17|05:00:42.255] Engine API enabled                       protocol=eth
INFO [01-17|05:00:42.256] Starting peer-to-peer node               instance=Geth/v1.10.23-stable/linux-amd64/go1.18.7
INFO [01-17|05:00:42.266] New local node record                    seq=1,673,931,642,265 id=8cd9239cc44ee0ed ip=127.0.0.1 udp=30303 tcp=30303
INFO [01-17|05:00:42.270] IPC endpoint opened                      url=/root/chain/el/geth.ipc
INFO [01-17|05:00:42.271] Generated JWT secret                     path=/root/chain/el/geth/jwtsecret
INFO [01-17|05:00:42.271] Started P2P networking                   self=enode://8420e0c5414b2f055506e94d0df24644c43096d80f081fd0f2cc4f9f4e506093846bc39132cc390cf8af1a0bf493b3c9bb21ef7ad7f785a665badef939ef5fd4@127.0.0.1:30303
INFO [01-17|05:00:42.272] HTTP server started                      endpoint=[::]:8545 auth=false prefix= cors= vhosts=*
INFO [01-17|05:00:42.274] WebSocket enabled                        url=ws://127.0.0.1:8551
INFO [01-17|05:00:42.274] HTTP server started                      endpoint=127.0.0.1:8551 auth=true  prefix= cors=localhost vhosts=localhost
INFO [01-17|05:00:42.796] Block synchronisation started 
INFO [01-17|05:00:42.836] Downloader queue stats                   receiptTasks=0 blockTasks=0 itemSize=650.00B throttle=8192
ERROR[01-17|05:00:42.965] Pending request exists for joining peer  peer=188b153e
INFO [01-17|05:00:42.985] Imported new chain segment               blocks=384 txs=0 mgas=0.000 elapsed=143.857ms   mgasps=0.000 number=384 hash=f41394..43db99 age=6mo3w23h dirty=0.00B
INFO [01-17|05:00:43.261] Imported new chain segment               blocks=192 txs=0 mgas=0.000 elapsed=88.534ms    mgasps=0.000 number=576 hash=6d5aec..a45043 age=6mo3w23h dirty=0.00B
INFO [01-17|05:00:43.447] New local node record                    seq=1,673,931,642,266 id=8cd9239cc44ee0ed ip=54.169.250.225 udp=30303 tcp=30303
INFO [01-17|05:00:44.125] Imported new chain segment               blocks=2048 txs=0 mgas=0.000 elapsed=851.476ms   mgasps=0.000 number=2624 hash=7c4bec..deafcf age=6mo3w15h dirty=0.00B
INFO [01-17|05:00:44.737] Imported new chain segment               blocks=2048 txs=0 mgas=0.000 elapsed=593.371ms   mgasps=0.000 number=4672 hash=aa3153..b98a55 age=6mo3w7h  dirty=0.00B
INFO [01-17|05:00:45.415] Imported new chain segment               blocks=2048 txs=0 mgas=0.000 elapsed=651.075ms   mgasps=0.000 number=6720 hash=150c46..9a3526 age=6mo2w6d  dirty=0.00B
INFO [01-17|05:00:46.080] Imported new chain segment               blocks=2048 txs=0 mgas=0.000 elapsed=645.732ms   mgasps=0.000 number=8768 hash=8b0d1f..80c2d0 age=6mo2w6d  dirty=0.00B
INFO [01-17|05:00:46.661] Imported new chain segment               blocks=2048 txs=0 mgas=0.000 elapsed=552.193ms   mgasps=0.000 number=10816 hash=f8383b..8e1d36 age=6mo2w6d  dirty=0.00B
...
...
...
INFO [01-17|05:08:23.927] Imported new chain segment               blocks=2048 txs=0    mgas=0.000   elapsed=995.844ms   mgasps=0.000  number=1,245,760 hash=2f6948..824352 age=4h52m26s  dirty=2.71MiB
INFO [01-17|05:08:24.575] Imported new chain segment               blocks=1251 txs=8    mgas=0.945   elapsed=636.772ms   mgasps=1.485  number=1,247,011 hash=e40b3c..bb6021 dirty=2.72MiB
INFO [01-17|05:08:25.305] Imported new chain segment               blocks=2    txs=0    mgas=0.000   elapsed=1.522ms     mgasps=0.000  number=1,247,013 hash=1291f0..cf6ccf dirty=2.72MiB
INFO [01-17|05:08:33.160] Imported new chain segment               blocks=1    txs=0    mgas=0.000   elapsed="829.446µs" mgasps=0.000  number=1,247,014 hash=aa3419..6daab6 dirty=2.72MiB

Executing the above command will receive the previous blocks. You can see that 'age' is getting smaller and smaller in the log contents.
If the block number in the log is the same as the most recent block number found at http://boascan.io, all historical data has been received.
Also, if the number of imported blocks, such as the last line, is 1, then all are received.

7. Running 'agora-cl-node'

Do not exit 'agora-el-node' you previously ran, connect the instance of EC2 with a new terminal.

6.1. To connect using a new terminal

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to connect.
  • Click the button Connect in the upper right corner. This will switch to the Connect to instance screen.
  • Click the button Connect in the lower right corner.
  • It is then connected to the EC2 Instance as a terminal.

7.2. Run 'agora-cl-node' to receive all previously created blocks

Run the command below to navigate to the installed folder.

cd agora-chain-mainnet

Run 'agora-cl-node' by running the command below.

./agora.sh cl-node run

The following logs are generated by executing the above command.

Unable to find image 'bosagora/agora-cl-node:v1.0.3' locally
v1.0.3: Pulling from bosagora/agora-cl-node
b49b96595fd4: Already exists 
9411f38bb959: Already exists 
39621572cdf6: Already exists 
c5a366754cd7: Already exists 
7c3f66696336: Pull complete 
3c2cba919283: Pull complete 
Digest: sha256:a5bdb94a63d4f5071316f54121976fdf7e03c1f7dfd077e5dd197c7d2d357365
Status: Downloaded newer image for bosagora/agora-cl-node:v1.0.3

Terms of Use

By downloading, accessing or using the Agora-cl implementation (“Agora-cl”), you (referenced herein
as “you” or the “user”) certify that you have read and agreed to the terms and conditions below.

TERMS AND CONDITIONS: https://github.com/bosagora/agora-cl/blob/agora/TERMS_OF_SERVICE.md


Type "accept" to accept this terms and conditions [accept/decline]: (default: decline):
accept

Enter 'accept' here.

[2023-01-17 09:12:34]  WARN flags: Running Agora-cl (Agora Consensus Layer) client using chain configuration yaml file
[2023-01-17 09:12:34]  WARN node: Agora-cl configured for AGORA MAINNET
[2023-01-17 09:12:34]  INFO node: Checking DB database-path=/root/chain/cl/beaconchaindata
[2023-01-17 09:12:34]  INFO db: Opening Bolt DB at /root/chain/cl/beaconchaindata/beaconchain.db
[2023-01-17 09:12:34]  INFO node: Deposit contract: 0xc26dd0f6e94afe288a2dd5d300f4ddaa0d93d9cb
[2023-01-17 09:12:34]  INFO p2p: Running node with peer id of 16Uiu2HAmHXUd8aMCphUHFVqAq6GiSMgiRpiJPHEE523pUdXtVyDj 
[2023-01-17 09:12:34]  INFO rpc: gRPC server listening on port address=0.0.0.0:4000
[2023-01-17 09:12:34]  INFO rpc: You are using an insecure gRPC server. This is expected when running your beacon node and validator on the same machine as recommended.
[2023-01-17 09:12:34]  INFO node: Starting beacon node version=Prysm/Unknown/e2340867bda56a483e858711d6fd0d2a79af8e37. Built at: 2022-11-22 23:56:48+00:00
[2023-01-17 09:12:34]  INFO initial-sync: Waiting for state to be initialized
[2023-01-17 09:12:34]  INFO blockchain: Waiting to reach the validator deposit threshold to start the beacon chain...
[2023-01-17 09:12:34]  INFO gateway: Starting API middleware
[2023-01-17 09:12:34]  INFO gateway: Starting gRPC gateway address=0.0.0.0:3500
[2023-01-17 09:12:49]  INFO powchain: Connected to new endpoint: /***
[2023-01-17 09:15:20] ERROR powchain: Unable to process past deposit contract logs, perhaps your execution client is not fully synced error=no contract code at given address
[2023-01-17 09:16:22]  WARN powchain: Execution client is not syncing
[2023-01-17 09:16:22] ERROR powchain: could not get eth1 block hash: could not query header with height 724481: not found
[2023-01-17 09:16:32]  WARN powchain: Execution client is not syncing
[2023-01-17 09:16:32]  INFO powchain: Falling back to historical headers and logs sync. Current difference is 448
[2023-01-17 09:16:46]  WARN powchain: Execution client is not syncing
[2023-01-17 09:16:46]  INFO powchain: Falling back to historical headers and logs sync. Current difference is 47172
[2023-01-17 09:17:56]  INFO powchain: Currently waiting for chainstart Additional validators needed=1023 Generating genesis state in=1506h44m29s
[2023-01-17 09:17:56]  WARN powchain: Execution client is not syncing
[2023-01-17 09:17:56]  INFO powchain: Falling back to historical headers and logs sync. Current difference is 98540

After a long time, the following log is output.

[2023-01-18 06:58:41]  INFO initial-sync: Starting initial chain sync...
[2023-01-18 06:58:41]  INFO initial-sync: Waiting for enough suitable peers before syncing required=3 suitable=0
[2023-01-18 06:58:41]  INFO p2p: Started discovery v5 ENR=enr:-MK4QH8beJU0lWG4lU3IUijLM4jVCRHwKZ9qNmmwgdh3t5HZZazlndZIldm9GLO6WPdopDlK5MuyzxeCGdS0CyEoeHOGAYXDrDT3h2F0dG5ldHOIAAAAAAAAAACEZXRoMpCfk-OaLxoCAJwYAAAAAAAAgmlkgnY0gmlwhA3U1TGJc2VjcDI1NmsxoQNiEe83U3MX6Z0b0vxit39llPEWEY1NNmKZeI61bpbQsYhzeW5jbmV0cwCDdGNwgjLIg3VkcIIu4A
[2023-01-18 06:58:41]  INFO p2p: Node started p2p server multiAddr=/ip4/172.17.0.3/tcp/13000/p2p/16Uiu2HAmKFpAbk14ua3xS2xe3sHiDsmVgWYCtNPpXsHLrJKLUJkg
[2023-01-18 06:58:41]  INFO p2p: Node started external p2p server multiAddr=/ip4/13.212.213.49/tcp/13000/p2p/16Uiu2HAmKFpAbk14ua3xS2xe3sHiDsmVgWYCtNPpXsHLrJKLUJkg
[2023-01-18 06:58:46]  INFO initial-sync: Processing block batch of size 31 starting from  0x663d83fe... 49665/49732 - estimated time remaining 43s blocksPerSecond=1.6 peers=10
[2023-01-18 06:58:47]  INFO initial-sync: Processing block batch of size 37 starting from  0x07483e92... 49696/49732 - estimated time remaining 10s blocksPerSecond=3.4 peers=10
[2023-01-18 06:58:47]  INFO initial-sync: Synced to finalized epoch - now syncing blocks up to current head currentSlot=49732 syncedSlot=49732
[2023-01-18 06:58:47]  INFO initial-sync: Synced up to slot 49732
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/beacon_block/ssz_snappy
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/beacon_aggregate_and_proof/ssz_snappy
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/voluntary_exit/ssz_snappy
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/proposer_slashing/ssz_snappy
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/attester_slashing/ssz_snappy
[2023-01-18 06:58:47]  INFO sync: Subscribed to topic topic=/eth2/9f93e39a/sync_committee_contribution_and_proof/ssz_snappy
[2023-01-18 06:58:53]  INFO blockchain: Synced new block block=0x7b407a3b... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49733
[2023-01-18 06:58:53]  INFO blockchain: Finished applying state transition attestations=1 slot=49733 syncBitsCount=511
[2023-01-18 06:58:56]  INFO powchain: Connected to new endpoint: /***
[2023-01-18 06:59:05]  INFO blockchain: Synced new block block=0x98df813e... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49734
[2023-01-18 06:59:05]  INFO blockchain: Finished applying state transition attestations=1 slot=49734 syncBitsCount=511
[2023-01-18 06:59:17]  INFO blockchain: Synced new block block=0x83334714... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49735
[2023-01-18 06:59:17]  INFO blockchain: Finished applying state transition attestations=1 slot=49735 syncBitsCount=511
[2023-01-18 06:59:29]  INFO blockchain: Synced new block block=0x01c0949d... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49736
[2023-01-18 06:59:29]  INFO blockchain: Finished applying state transition attestations=1 slot=49736 syncBitsCount=511
[2023-01-18 06:59:41]  INFO p2p: Peer summary activePeers=24 inbound=4 outbound=20
[2023-01-18 06:59:41]  INFO blockchain: Synced new block block=0x3e900abf... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49737
[2023-01-18 06:59:41]  INFO blockchain: Finished applying state transition attestations=1 slot=49737 syncBitsCount=511
[2023-01-18 06:59:53]  INFO blockchain: Synced new block block=0x9c28db03... epoch=1554 finalizedEpoch=1552 finalizedRoot=0x708ea5b4... slot=49738
[2023-01-18 06:59:53]  INFO blockchain: Finished applying state transition attestations=1 slot=49738 syncBitsCount=511

If the slot in the log is the same as the most recent slot found on http://agorascan.io, all historical data has been received.

8. Running 'agora-cl-validator'

8.1. To connect using a new terminal

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to connect.
  • Click the button Connect in the upper right corner. This will switch to the Connect to instance screen.
  • Click the button Connect in the lower right corner.
  • It is then connected to the EC2 Instance as a terminal.

Run the command below to navigate to the installed folder.

cd agora-chain-mainnet

8.2. Importing a validator's key

You can import multiple validation keys to a single server.
The validator key must be generated by the user as a key generation program.
The validator key is used when the validator program signs blocks proposed by other validators.
The file name of the validator key is in the following format: # is any number.

keystore-m_12381_3600_0_0_0-##########.json

A folder called 'root/wallet' is created when the validator key is imported. Multiple validation keys are stored here as a single file.
You must also enter a password to access 'wallet'.
When you import the first validator key, 'wallet' is automatically generated. Enter the password for 'wallet' at this time.
Therefore, you should understand that the password of the validator key and the password of the wallet may exist differently.

8.2.1. Send validator key to server

There are many ways to transfer files to a server.
Here, we'll try copying the contents of a file on my computer, and then creating and pasting the file on the server.

Use the command below to create a folder named mykeys under the folder root.

mkdir root/mykeys

Use the command below to create the file key1.json under the folder root/mykeys and run the editor.

nano root/mykeys/key1.json
  • The shortcuts for commands in the nono editor are as follows:
shortcuts function
ctrl+g Show Help
ctrl+x nano exit (or close the current file buffer)
ctrl+o Save the file you are currently editing
ctrl+j Put the ends of the paragraphs side by side
ctrl+r Add the contents of another file to the current file.
ctrl+k Delete and copy the current line or selected text
ctrl+u Paste

Select one of the validator key files on your My Computer and read it to the text editor.
And copy and paste the content into AWS' terminal.
The validator key file on my computer looks like this: # is any number.

keystore-m_12381_3600_0_0_0-##########.json

Now root/mykeys/key1.json has copied the contents of the validator key file that you generated on my computer.
Press ctrl+o to save. The file name will then show you and ask if you want to save or cancel. Press Enter to save.
Then press ctrl+x to exit the editor.

8.2.2. Importing validator key

The command below imports all validator keys inside the folder root/mykeys into the wallet.

./agora.sh validator accounts import mykeys
Unable to find image 'bosagora/agora-cl-validator:v1.0.3' locally
v1.0.3: Pulling from bosagora/agora-cl-validator
b49b96595fd4: Already exists 
9411f38bb959: Already exists 
39621572cdf6: Already exists 
c5a366754cd7: Already exists 
e4f0a6926093: Pull complete 
3c2cba919283: Pull complete 
Digest: sha256:997571c68b44aded52c10915fa9b0b96fca3391d71f5bfcf7ab6b6635b189976
Status: Downloaded newer image for bosagora/agora-cl-validator:v1.0.3

Terms of Use

By downloading, accessing or using the Agora-cl implementation (“Agora-cl”), you (referenced herein
as “you” or the “user”) certify that you have read and agreed to the terms and conditions below.

TERMS AND CONDITIONS: https://github.com/bosagora/agora-cl/blob/agora/TERMS_OF_SERVICE.md


Type "accept" to accept this terms and conditions [accept/decline]: (default: decline):

Enter accept.

[2023-01-17 08:46:28]  WARN flags: Running Agora-cl (Agora Consensus Layer) client using chain configuration yaml file
Password requirements: at least 8 characters
New wallet password: 

Enter the password to create 'wallet' because it did not exist at the first run.

Confirm password: 

The above is printed out. Once again, enter the same password.

[2023-01-17 08:48:26]  INFO accounts: Successfully created new wallet wallet-path=/root/wallet
[2023-01-17 08:48:26]  INFO validator: You are using an insecure gRPC connection. This is expected when running your beacon node and validator on the same machine as recommended.
Enter the password for your imported accounts: 

When the above is printed, you can now enter the password of the validator key to be imported.

Importing accounts, this may take a while...
Importing accounts... 100% [==========================================]  [1s:0s]
Successfully imported 1 accounts, view all of them by running `accounts list`

This will import all keys inside the folder.

Importing accounts, this may take a while...
[2023-01-17 08:53:06]  WARN accounts: Could not import keystore for 9475fc6d96c368c2efcbc4337e40fd28231dfda319016dc96a6604c716501cf2aefb2f73b5b58261f49d25ee4a035bea: incorrect password for key 0x9475fc6d96c368c2efcbc4337e40fd28231dfda319016dc96a6604c716501cf2aefb2f73b5b58261f49d25ee4a035bea
Successfully imported 1 accounts, view all of them by running `accounts list`

If it is printed on the same day as above, it means that the validator key cannot be imported because the password is entered incorrectly.

The import is now complete.

8.2.3. To print a list of imported validator keys

Verify that the validation key has been successfully imported and to verify again, run the following command

./agora.sh validator accounts list

The following is displayed. Enter accept in this course. You must enter the password for 'wallet'.
This will output the public keys of the imported validator.

Terms of Use

By downloading, accessing or using the Agora-cl implementation (“Agora-cl”), you (referenced herein
as “you” or the “user”) certify that you have read and agreed to the terms and conditions below.

TERMS AND CONDITIONS: https://github.com/bosagora/agora-cl/blob/agora/TERMS_OF_SERVICE.md


Type "accept" to accept this terms and conditions [accept/decline]: (default: decline):
accept
[2023-01-17 08:57:11]  WARN flags: Running Agora-cl (Agora Consensus Layer) client using chain configuration yaml file
Wallet password: 
[2023-01-17 08:57:17]  INFO validator: You are using an insecure gRPC connection. This is expected when running your beacon node and validator on the same machine as recommended.
(keymanager kind) local wallet

Showing 1 validator account
View the eth1 deposit transaction data for your accounts by running `validator accounts list --show-deposit-data`

Account 0 | namely-secure-katydid
[validating public key] 0x9475fc6d96c368c2efcbc4337e40fd28231dfda319016dc96a6604c716501cf2aefb2f73b5b58261f49d25ee4a035bea

8.3. Creating text with the wallet's password written on it

The validator program must read the validator key in 'wallet' for it to run.
However, only the user knows the password for 'wallet', and the program does not know it, so program ask it every time it runs.
This is good for security, but it is difficult to solve for running a program in the background.
Therefore, you should record the password in text and inform the validator program.

Use the following command to enter a password for automatic and background execution.
The default value is 'password'. Please change this to the password of the wallet.

nano root/config/cl/password.txt

The commands in the nano editor are the same as before.
Save : ctrl+o and Enter
Exit : ctrl+x

8.4. Registering a fee deposit account

From February 9, 2023, the validator's ability to propose blocks will be added.
The BOSagora network pays the validator a transaction fee included in the validator's proposed block.
In order to receive this compensation, you need to register your account.
The information in the account can be set differently for each validator. For convenience, we will set the payment to one address.

Reference

Run the following command to modify the fee deposit account.

nano root/config/cl/proposer_config.json

Then you can check that the following contents already exist.

{
  "proposer_config": {
    "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000": {   
      "fee_recipient": "0x0000000000000000000000000000000000000000"
    }
  },
  "default_config": {
    "fee_recipient": "0x0000000000000000000000000000000000000000"
  }
}

You can modify it as below. For fee_recipient, enter the user's metamask address.

{
  "proposer_config": {
  },
  "default_config": {
    "fee_recipient": "0xD85864db188F0425556139872c764c4Ee64dE3B3"
  }
}

The commands in the nano editor are the same as before.
Save : ctrl+o and Enter
Exit : ctrl+x

8.5. Running the validator client

When 'agora-el-node' and 'agora-cl-node' are running, run the following command to run the validator client.

./agora.sh validator run

The following log is then output.

[2023-01-18 07:01:51]  WARN flags: Running Agora-cl (Agora Consensus Layer) client using chain configuration yaml file
[2023-01-18 07:01:51]  INFO node: Opened validator wallet keymanager-kind=direct wallet=/root/wallet/direct
[2023-01-18 07:01:51]  WARN node: Slashing protection file /root/chain/cl/validator.db is missing.
If you changed your --wallet-dir or --datadir, please copy your previous "validator.db" file into your current --datadir.
Disregard this warning if this is the first time you are running this set of keys.
[2023-01-18 07:01:51]  INFO node: Checking DB databasePath=/root/chain/cl/
Adding optimizations for validator slashing protection 100% [===================================================================================================================]  [0s:0s]
[2023-01-18 07:01:51]  INFO validator: You are using an insecure gRPC connection. This is expected when running your beacon node and validator on the same machine as recommended.
[2023-01-18 07:01:51]  INFO node: Starting validator node version=Prysm/Unknown/e2340867bda56a483e858711d6fd0d2a79af8e37. Built at: 2022-11-23 00:07:41+00:00
[2023-01-18 07:01:51]  INFO validator: Syncing with beacon node to align on chain genesis info
[2023-01-18 07:01:51]  INFO validator: Beacon chain started genesisTime=2023-01-11 09:12:17 +0000 UTC
[2023-01-18 07:01:51]  INFO validator: Validating for public key publicKey=0x9475fc6d96c3
[2023-01-18 07:01:51]  INFO validator: Waiting for deposit to be observed by beacon node pubKey=0x9475fc6d96c3 status=UNKNOWN_STATUS

After 12 hours of depositing 40,000 BOA, validators are activated and act as validator.
If the validator client does not start within 12 hours of deposit, the BOA's balance will be reduced due to a penalty.
Therefore, please have sufficient knowledge of node installation and operation before depositing 40,000 BOA.

9. To run in the background using 'docker-compose'

The 'agora-el-node', 'agora-cl-node', and 'agora-cl-validator' that have been started so far will also terminate the process when the connection to the server is stopped.
Therefore, you must ensure that these processes run in the background.
An easy way to do this is to use 'docker-compose'.

First, you check if synchronization of historical block data of 'agora-el-node', 'agora-cl-node' is completed.
When all blocks are synchronized, you press ctrl+c to end the process in this order: 'agora-cl-validator', 'agora-cl-node', and 'agora-el-node'.

The command below runs three processes in the background.

./agora.sh docker-compose up                                                                                         

The following log is then output.

Creating network "agora-chain-mainnet_default" with the default driver
Creating agora-el-node ... done
Creating agora-cl-node ... done
Creating agora-cl-validator ... done

The command to terminate the process is as follows.

./agora.sh docker-compose down

To view the execution status of the nodes, check the log using the docker command.

You can check the log of 'agora-el-node' by executing the command below. Enter ctrl+c to exit.

docker logs -f agora-el-node

You can check the log of 'agora-cl-node' by executing the command below. Enter ctrl+c to exit.

docker logs -f agora-cl-node

You can check the log of 'agora-cl-validator' by executing the command below. Enter ctrl+c to exit.

docker logs -f agora-cl-validator

10. Using 'docker-compose' to monitor

10.1. To set up a Firewall (security groups)

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to change the firewall.
  • Select the tab Security in the bottom tabs.
  • Click Security Group currently set in EC2.
  • Click the button Edit inbound rules on the right. This switches to the Edit inbound rules screen.
  • Click the button 'Add rule'.
  • Select Type: Custom TCP; Port range : 3000; Source : Anyway IP4 in the newly added rule.
  • Click the button 'Save rules'.

10.2. To connect using a new terminal

  • Access AWS EC2 Dashboard.
  • Select the Instance item to go to the screen that shows the instances.
  • Select the EC2 instance for which you want to connect.
  • Click the button Connect in the upper right corner. This will switch to the Connect to instance screen.
  • Click the button Connect in the lower right corner.
  • It is then connected to the EC2 Instance as a terminal.

10.3. Start running 'docker-compose' with built-in monitoring capabilities

Run the command below to navigate to the installed folder.

cd agora-chain-mainnet

Shut down all existing processes.

./agora.sh docker-compose down

Run 'docker-compose' with built-in monitoring.

./agora.sh docker-compose-monitoring up

The command to terminate the process is as follows.

./agora.sh docker-compose-monitoring down

10.4.Setting Up Grafana

In your web browser, type the following address

http://[IP of EC2]:3000

The IP of EC2 exists in the instance entry of AWS 'EC2 Dashboard'.

The first login ID is admin, and the password is admin.
When you log in, you will see a screen to change your password. If you enter a new password, the password will change.

10.5. Adding Grafana Data Source

Click the gear icon at the bottom of the left menu to display the menu window. Select Data sources from the menu pane.
This switches to a screen where you can add a data source.
Click the Add data source button in the center of the screen.
Select Prometheus.
Type http://prometheus:9090 in the URL entry.
Type 60s in the Scrape interval entry.
Click the button Save & test at the bottom of the screen.
If all the courses are set up well, a pop-up message Data source is working will be displayed.

10.6. Adding Grafana Dashboard

When you click the fourth icon at the top of the left menu, a menu called Dashboards appears. Select + import from the menu pane.
Copy the contents of the URL below.

https://raw.githubusercontent.com/bosagora/agora-chain/v0.x.x/networks/mainnet/monitoring/dashboard/agora-chain-dashboard.json

Paste the copy into the Import via panel json input window on the Dashboard/Import dashboard screen.
This adds a new dashboard and appears on the screen.
Each item shows a brief description by over-clicking on the top left-hand corner of the i.

11. Upgrading node execution scripts and settings

The script you are using and the configuration files needed to run the node can be upgraded continuously.
Therefore, users should periodically check the upgrade status of node programs and settings.

Run the following commands to upgrade.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/bosagora/agora-chain/mainnet/upgrade.sh)"