Skip to content

Running Avail Node Together With LCs

Marko Petrlić edited this page Oct 13, 2023 · 19 revisions

Running Avail Node Together With LCs

This is a complete guide on how to setup a network of one Node, one Boostrap LC Node and two LC nodes.

Manually

# All our repos will be stored inside the work directory
mkdir work && cd work
# Cloning and building Node, LC, Bootstrap LC
git clone https://github.com/availproject/avail.git node && cd node && git checkout v1.7.2 && cargo build --release && cd ./.. \
git clone https://github.com/availproject/avail-light.git light && cd light && git checkout v1.7.2 && cargo build --release && cd ./.. \
git clone https://github.com/availproject/avail-light-bootstrap.git boostrap && cd boostrap && git checkout v0.0.1 && cargo build --release && cd ./..

Create 4 terminal windows. Make sure that the current directory for these terminals is set to ourwork

Terminal 1: Node

cd node && ./target/release/data-avail --dev

Once the Node is running, wait for it to finalize the first block before continuing with this guide

Output

If everything worked correctly, you should see this message:

2023-10-13 11:23:03 Avail Node    
2023-10-13 11:23:03 ✌️  version 1.7.2-0fd1b21757c    
2023-10-13 11:23:03 ❤️  by Avail Team, 2017-2023    
2023-10-13 11:23:03 📋 Chain specification: Avail Development Network    
2023-10-13 11:23:03 🏷  Node name: ill-informed-approval-1189    
2023-10-13 11:23:03 👤 Role: AUTHORITY    
2023-10-13 11:23:03 💾 Database: RocksDb at /tmp/substratebBqgDp/chains/avail_development_network/db/full    
2023-10-13 11:23:04 [0] 💸 generated 1 npos voters, 1 from validators and 0 nominators    
2023-10-13 11:23:04 [0] 💸 generated 1 npos targets    
2023-10-13 11:23:04 🔨 Initializing Genesis block/state (state: 0x69fb…f0f0, header-hash: 0x5f02…e147)    
2023-10-13 11:23:04 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.    
2023-10-13 11:23:05 👶 Creating empty BABE epoch changes on what appears to be first startup.    
2023-10-13 11:23:05 🏷  Local node identity is: 12D3KooWAiD3S8WQDQRsJZjZj7AkApESd3gtXubun8DJ2vMifeuG    
2023-10-13 11:23:05 Prometheus metrics extended with avail metrics    
2023-10-13 11:23:05 💻 Operating system: linux    
2023-10-13 11:23:05 💻 CPU architecture: x86_64    
2023-10-13 11:23:05 💻 Target environment: gnu    
2023-10-13 11:23:05 💻 CPU: 13th Gen Intel(R) Core(TM) i7-13700K    
2023-10-13 11:23:05 💻 CPU cores: 16    
2023-10-13 11:23:05 💻 Memory: 31863MB    
2023-10-13 11:23:05 💻 Kernel: 6.5.5-100.fc37.x86_64    
2023-10-13 11:23:05 💻 Linux distribution: Fedora Linux 37 (Workstation Edition)    
2023-10-13 11:23:05 💻 Virtual machine: no    
2023-10-13 11:23:05 📦 Highest known block at #0    
2023-10-13 11:23:05 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["*"]    
2023-10-13 11:23:05 🏁 CPU score: 1.64 GiBs    
2023-10-13 11:23:05 🏁 Memory score: 22.82 GiBs    
2023-10-13 11:23:05 🏁 Disk score (seq. writes): 6.83 GiBs    
2023-10-13 11:23:05 🏁 Disk score (rand. writes): 2.68 GiBs    
2023-10-13 11:23:05 〽️ Prometheus exporter started at 127.0.0.1:9615    
2023-10-13 11:23:05 👶 Starting BABE Authorship worker    
2023-10-13 11:23:10 💤 Idle (0 peers), best: #0 (0x5f02…e147), finalized #0 (0x5f02…e147), ⬇ 0 ⬆ 0    
2023-10-13 11:23:15 💤 Idle (0 peers), best: #0 (0x5f02…e147), finalized #0 (0x5f02…e147), ⬇ 0 ⬆ 0    
2023-10-13 11:23:20 🙌 Starting consensus session on top of parent 0x5f02e3d7948404f734b844f27b9c3831e2c938384df5c73e59bda4d2d9a0e147    
2023-10-13 11:23:20 🎁 Prepared block for proposing at 1 (26 ms) [hash: 0xd351d48434b397176d2716b43d491b8e49e2be969c6d29edc09516a6bf7e7465; parent_hash: 0x5f02…e147; extrinsics (1): [0x3a99…3fe8]    
2023-10-13 11:23:20 🔖 Pre-sealed block for proposal at 1. Hash now 0x20db591aa3a0078a6cab354dd83fc07682a1ce9819de6463d9790480e4c8d46d, previously 0xd351d48434b397176d2716b43d491b8e49e2be969c6d29edc09516a6bf7e7465.    
2023-10-13 11:23:20 👶 New epoch 0 launching at block 0x20db…d46d (block slot 84859450 >= start slot 84859450).    
2023-10-13 11:23:20 👶 Next epoch starts at slot 84859630    
2023-10-13 11:23:20 ✨ Imported #1 (0x20db…d46d)    

Terminal 2: Bootstrap LC

cd boostrap

# This is one single command, make sure you copy everything
cat << EOF >> myconfig.yaml
http_server_host = '127.0.0.1'
http_server_port = 7700
log_level = 'INFO'
log_format_json = false
port = 37000
identify_protocol = '/avail_kad/id/1.0.0'
identify_agent = 'avail-light-client/rust-client'
autonat_only_global_ips = false
kad_connection_idle_timeout = 30
kad_query_timeout = 60
bootstrap_period = 300
ot_collector_endpoint = 'http://otelcollector.avail.tools:4317'
metrics_network_dump_interval = 360
secret_key = { seed="light-bootstrap" }
EOF

# Run Boostrap LC
./target/release/avail-light-bootstrap --config myconfig.yaml

Output

If everything worked correctly, you should see this message:

2023-10-13T09:25:46.200515Z  INFO avail_light_bootstrap::network: Local Peer ID: PeerId("12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw"). Public key: PublicKey { publickey: Ed25519(PublicKey(compressed): f28d99e601ecbb1ee3e3247bad1f5c1ff39b74bf673fa14b1443d13d1730) }.
2023-10-13T09:25:46.201013Z  INFO avail_light_bootstrap::server: HTTP server running on http://127.0.0.1:7700
2023-10-13T09:25:46.201073Z  INFO Server::run{addr=127.0.0.1:7700}: warp::server: listening on http://127.0.0.1:7700
2023-10-13T09:25:46.201679Z  INFO avail_light_bootstrap: Started listening on port: 37000.
2023-10-13T09:25:46.201684Z  INFO avail_light_bootstrap: Bootstrap node starting ...
2023-10-13T09:25:46.201718Z  INFO avail_light_bootstrap::network::event_loop: Local node is listening on: "/ip4/127.0.0.1/udp/37000/quic-v1/p2p/12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw"
2023-10-13T09:25:46.201730Z  INFO avail_light_bootstrap::network::event_loop: Local node is listening on: "/ip4/192.168.1.125/udp/37000/quic-v1/p2p/12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw"

Subnet Address

From the log remember the subnet address because it is going to be used in the next phase. In this case, the subnet address is 192.168.1.125. You can read it from the last line of the log:

... "/ip4/192.168.1.125/udp/37000/quic-v1/p2p/12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw"

Error message

If you see an error message like this:

2023-10-13T09:26:01.201196Z ERROR avail_light_bootstrap::network::event_loop: AutoNAT Outbound Probe failed with Peer: None. Error: NoServer

you can safely ignore it.

Terminal 3: LC Node 1

cd light

# This is one single command, make sure you copy everything
cat << EOF >> myconfig1.yaml
log_level = "info"
http_server_host = "127.0.0.2"
http_server_port = "7001"
secret_key = { seed = "avail" }
port = 37001
full_node_ws = ["ws://127.0.0.1:9944"]
app_id = 0
confidence = 92.0
avail_path = "avail_path"
bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.124/udp/37000/quic-v1"]]
EOF

Open myconfig1.yaml in your favorite text editor and change the last line so t hat the subnet address matches your subnet address. The subnet address for this guide is 192.168.1.125 so I change it to that, but make sure that you use your own subnet address from step Subnet Address

- bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.124/udp/37000/quic-v1"]]
+ bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.125/udp/37000/quic-v1"]]

Run LC

./target/release/avail-light --config myconfig1.yaml

Output

Log on Bootstrap

If LC and Boostrap are successfully paired the following message should be logged in the Boostrap terminal:

2023-10-13T09:43:53.822521Z  INFO avail_light_bootstrap: Bootstrap done.

Terminal 4: LC Node 2

cd light

# This is one single command, make sure you copy everything
cat << EOF >> myconfig2.yaml
log_level = "info"
http_server_host = "127.0.0.3"
http_server_port = "7002"
secret_key = { seed = "avail-2" }
port = 37002
full_node_ws = ["ws://127.0.0.1:9944"]
app_id = 0
confidence = 92.0
avail_path = "avail_path2"
bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.124/udp/37000/quic-v1"]]
EOF

Open myconfig2.yaml in your favorite text editor and change the last line so t hat the subnet address matches your subnet address. The subnet address for this guide is 192.168.1.125 so I change it to that, but make sure that you use your own subnet address from step Subnet Address

- bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.124/udp/37000/quic-v1"]]
+ bootstraps = [["12D3KooWS9BZnKansQfo6AHJ54gZbSPTPENHEdr3JWEFJ5NELKAw", "/ip4/192.168.1.125/udp/37000/quic-v1"]]

Run LC

./target/release/avail-light --config myconfig2.yaml