Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

If you wish to join an existing network, skip down to the Joining Existing Network Section.

Pulling the Latest Docker Images:

Code Block
languagebash
titleBootstrap Setup
linenumberstrue
docker pull casperlabs/node:latest
docker pull casperlabs/client:latest
docker pull casperlabs/execution-engine:latest

Setup Bootstrap for New Network:

Note

In my example I have my keys stored in my data directory. If you wish to store your keys elsewhere you will need to also mount that directory to the container. See docker's docs for examples.

...

Code Block
languagebash
titleBootstrap Setup
linenumberstrue
# Docker only: If you are using docker to setup your nodes you must make sure the EE and Node containers are on the same network.
# For this demo, I created a network called "casperlabs"
bootstrap:~$ docker network create casperlabs

# Create the .casperlabs directory you plan to use for your node. Here I created it in my home directory.
bootstrap:~$ mkdir -p ~/.casperlabs

# Create the genesis directory
bootstrap:~$ mkdir -p ~/.casperlabs/genesis

# Create the bonds.txt file to be used by your network. This file should contain the Base64 validator-id of your nodes.
bootstrap:~$ vi ~/.casperlabs/genesis/bonds.txt

# Input the keys for each of your validators, in my case this will be 1 of them, and give them a weight on the network.
1KzamFTtaBw9Or1VypuruBvjeLIy3oBSSfw75Sj3ZVw= 10

# save and close your file

# Download the system contracts and untar them
curl -o ~/.casperlabs/genesis/system-contracts.tar.gz http://repo.casperlabs.io/casperlabs/repo/master/system-contracts.tar.gz
tar -xzvf ~/.casperlabs/genesis/system-contracts.tar.gz --directory ~/.casperlabs/genesis/

# We must start the execution-engine container before we start the node container.
# Note: You can name the container anything you wish, here I refer to it as cl-engine.
bootstrap:~$ docker run --rm --name cl-engine -dit -v ~/.casperlabs/:/root/.casperlabs/ --network casperlabs casperlabs/execution-engine:latest /root/.casperlabs/.caspernode.sock

# Next we can start the bootstrap node.
# Note: You can name the container anything you wish, here I refer to it as cl-boot.
# Note: This Bootstrap is started in readonly mode and is not a validator here. You can make it a validator by adding in additional flags. See the nodes help file for more details.

bootstrap:~$ docker run --rm --name cl-boot -dit --network casperlabs -p 40400-40405:40400-40405 -v ~/.casperlabs/:/root/.casperlabs/ casperlabs/node:latest run --server-data-dir=/root/.casperlabs --grpc-socket /root/.casperlabs/.caspernode.sock -s --casper-genesis-account-public-key-path /root/.casperlabs/genesis/validator-public.pem --casper-mint-code-path /root/.casperlabs/genesis/mint_token.wasm --casper-pos-code-path /root/.casperlabs/genesis/pos.wasm

# You can view the logs for the bootstrap while it is starting up. It's important to capture the address for your bootstrap (Listening for traffic on casperlabs://<address>),  which we will use later to start our other node.
# Once you see "Making the transition to block processing." the bootstrap is up and running.

bootstrap:~$ docker logs -f cl-boot
19:24:27.291 [main] INFO  io.casperlabs.node.Main$ - CasperLabs node 0.6.0 (260e9c292a40c90ceb94609b5b12cff2f5d69777)
19:24:27.305 [main] INFO  io.casperlabs.node.NodeEnvironment$ - Using data dir: /root/.casperlabs
19:24:27.749 [main] INFO  io.casperlabs.comm.UPnP$ - trying to open ports using UPnP....
19:24:36.823 [main] INFO  io.casperlabs.comm.UPnP$ - INFO - No gateway devices found
19:24:36.824 [main] INFO  io.casperlabs.comm.UPnP$ - No need to open any port
19:24:36.827 [main] INFO  io.casperlabs.comm.WhoAmI$ - flag --host was not provided, guessing your external IP address
19:24:36.951 [main] INFO  io.casperlabs.comm.WhoAmI$ - guessed 76.180.99.40 from source: AmazonAWS service
19:24:40.005 [main] INFO  o.f.c.i.license.VersionPrinter - Flyway Community Edition 5.2.4 by Boxfuse
19:24:40.181 [main] INFO  o.f.c.i.database.DatabaseFactory - Database: jdbc:sqlite:/root/.casperlabs/sqlite.db (SQLite 3.28)
19:24:40.243 [main] INFO  o.f.core.internal.command.DbValidate - Successfully validated 1 migration (execution time 00:00.034s)
19:24:40.253 [main] INFO  o.f.core.internal.command.DbMigrate - Current version of schema "main": 20190731.665
19:24:40.255 [main] INFO  o.f.core.internal.command.DbMigrate - Schema "main" is up to date. No migration necessary.
19:24:40.888 [main] WARN  i.c.blockstorage.FileDagStorage$ - CRC file /root/.casperlabs/dagstorage/latest-messages-crc did not contain a valid CRC value
19:24:40.922 [main] WARN  i.c.blockstorage.FileDagStorage$ - CRC file /root/.casperlabs/dagstorage/block-metadata-crc did not contain a valid CRC value
19:24:41.383 [main] INFO  io.casperlabs.node.api.Servers$ - Internal gRPC services started on port 40402.
19:24:41.437 [main] INFO  io.casperlabs.node.api.Servers$ - External gRPC services started on port 40401.
19:24:41.533 [main] INFO  io.casperlabs.node.MetricsRuntime - No Influx configuration found
19:24:41.556 [main] INFO  io.casperlabs.node.MetricsRuntime - Reporting metrics to InfluxDB disabled.
19:24:41.563 [main] INFO  io.casperlabs.node.MetricsRuntime - Reporting metrics to Prometheus disabled.
19:24:41.567 [main] INFO  io.casperlabs.node.MetricsRuntime - Reporting metrics to Zipkin disabled.
19:24:41.571 [main] INFO  io.casperlabs.node.MetricsRuntime - Reporting metrics to JMX.
19:24:41.608 [main] INFO  kamon.metrics.SystemMetrics - Starting the Kamon(SystemMetrics) module
19:24:42.313 [main] INFO  io.casperlabs.node.api.Servers$ - HTTP server started on port 40403.
19:24:43.341 [main] WARN  i.c.casper.ValidatorIdentity$ - No private key detected, cannot create validator identification.
19:24:43.391 [main] WARN  i.c.casper.ValidatorIdentity$ - No private key detected, cannot create validator identification.
19:24:43.395 [main] INFO  i.c.node.casper.gossiping.package$ - Starting without a validator identity.
19:24:43.403 [main] INFO  i.c.node.casper.gossiping.package$ - Starting in create genesis mode
19:24:43.408 [main] INFO  i.c.node.casper.gossiping.package$ - Constructing Genesis candidate...
19:24:43.421 [main] WARN  i.casperlabs.casper.genesis.Genesis$ - Specified wallets file /root/.casperlabs/genesis/wallets.txt does not exist. No wallets will exist at genesis.
19:24:43.544 [main] INFO  i.casperlabs.casper.genesis.Genesis$ - Reading Wasm code from /root/.casperlabs/genesis/mint_token.wasm
19:24:43.549 [main] INFO  i.casperlabs.casper.genesis.Genesis$ - Reading Wasm code from /root/.casperlabs/genesis/pos.wasm
19:24:44.200 [grpc-default-executor-0] INFO  i.c.node.casper.gossiping.package$ - Trying to store generated Genesis candidate 6c9c87c77d...
19:24:44.206 [grpc-default-executor-0] INFO  i.c.node.casper.gossiping.package$ - Validating genesis-like block 6c9c87c77d......
19:24:44.296 [grpc-default-executor-0] INFO  i.c.c.MultiParentCasperImpl$StatelessExecutor - Attempting to add Block with missing elements (6c9c87c77d...) to the DAG.
19:24:44.810 [grpc-default-executor-1] WARN  i.c.blockstorage.FileDagStorage$ - Block 6c9c87c77d6249acc79e5a495b8a55b1f150944b2b92baa2dd594e7a494fb9aa validator is empty
19:24:44.894 [grpc-default-executor-1] INFO  i.c.c.MultiParentCasperImpl$StatelessExecutor - Added 6c9c87c77d...
19:24:44.931 [grpc-default-executor-1] INFO  i.c.c.gossiping.GenesisApproverImpl - Transitioned to approved genesis state.
19:24:44.949 [node-runner-16] WARN  i.c.casper.ValidatorIdentity$ - No private key detected, cannot create validator identification.
19:24:45.077 [node-runner-16] INFO  i.c.node.casper.gossiping.package$ - Making the transition to block processing.
19:24:45.123 [grpc-default-executor-1] INFO  io.casperlabs.node.NodeRuntime - Starting stand-alone node.
19:24:45.135 [grpc-default-executor-1] INFO  io.casperlabs.node.NodeRuntime - Listening for traffic on casperlabs://2f1bf6ac0f99e90c0509c9e5aa1506969f0fd128@<ip>?protocol=40400&discovery=40404.
19:24:45.197 [blocking-io-40] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
19:24:45.231 [blocking-io-40] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.

# Note: -f flag will follow the log.  CTRL+C will exit or we can open a new terminal an continue to monitor the log.


Joining Existing Network:

Note

In this example, I was joining the network above that existed on a different machine. The same method applies for networks local to your network but you may need to adjust the ports. See docker's doc on networking for details.

...