How to Deploy a Flow Node: Observer Node Setup

How to Deploy a Flow Node: Observer Node Setup
How to Deploy a Flow Node

If you're interested in deploying a node on the Flow blockchain, you've come to the right place! This article will provide you with a detailed, step-by-step guide on how to set up your own Flow node. Let's jump in!

What is a Flow Node?

There are several types of Flow nodes; each fulfills a specific role, contributing to the overall security, efficiency, and accessibility of the Flow blockchain network. The following part highlights the differences between Flow nodes:

Collection Nodes:

  • Manage the transaction pool and propose transactions to Consensus nodes.
  • Required to stake a minimum of 250,000 FLOW.

Consensus Nodes:

  • Form and propose blocks using the HotStuff consensus algorithm.
  • Validate signed collection hashes from Collection nodes.
  • Required to stake a minimum of 500,000 FLOW.

Execution Nodes:

  • Execute transactions and maintain the Execution State.
  • Compute block outputs and interact with Collection nodes.
  • Required to stake a minimum of 1,250,000 FLOW.

Verification Nodes:

  • Verify the correctness of work done by Execution nodes.
  • Check a subset of computations in parallel.
  • Required to stake a minimum of 135,000 FLOW.

Access Nodes:

  • Act as a proxy to the Flow network, routing transactions and state queries.
  • Required to stake 100 FLOW but do not receive rewards.

Observer Nodes:

  • Provide locally accessible, continuously updated, verified copies of block data.
  • No staking is required; anyone can run an observer node.

Archive Nodes:

  • Offer scalable and efficient access to Flow protocol history and execution state.
  • No staking is required; anyone can run an archive node.

Get more insights into the Flow nodes here.

Set Up A Node on Flow Blockchain
Set Up A Node on Flow Blockchain

Flow Node Setup Requirements

Make sure your computer meets the minimum hardware requirements to run an Observer Node smoothly:

  • CPU with 2+ cores
  • Minimum of 4 GB RAM
  • 300 GB SSD disk
  • Network connection of at least 10Mbps

How to Deploy a Flow Node: Observer Node Setup

Step 1: Create the node directory structure

The directory structure needed by the observer node is as follows:

$ tree flow_observer
flow_observer/
├── bootstrap
│         ├── network.key (file containing the node private network key)
│         └── public-root-information
│             └── root-protocol-state-snapshot.json (the genesis data of the current spork)
└── data (directory used by the observer node to store block data)

Establish the main directory and its corresponding sub-folders, for example:

mkdir -p flow_observer/bootstrap/public-root-information
mkdir flow_observer/data

Step 2: Create the network key

To communicate with the network, the observer requires a networking ECDSA key, just like any other Flow node. Obtain the Bootstrapping kit and create the observer networking key.

curl -sL -O storage.googleapis.com/flow-genesis-bootstrap/boot-tools.tar
tar -xvf boot-tools.tar
./boot-tools/bootstrap observer-network-key  --output-file ./flow_observer/bootstrap/network.key

To generate the key, make sure to download the boot-tools for Mac if you are using a Mac device. For more details, look through Flow Developer Portal.

Step 3: Download the root-protocol-state-snapshot.json file

A root-protocol-state-snapshot.json file is created for every spork, which includes the initial data for that spork. It is released and accessible after each spork. Follow these steps to download:

  • To obtain the most recent spork version from sporks.json for mainnet, proceed to download both the root-protocol-state-snapshot.json and its corresponding signature file.

wget -P ./flow_observer/bootstrap/public-root-information https://storage.googleapis.com/flow-genesis-bootstrap/mainnet-<spork version>-execution/public-root-information/root-protocol-state-snapshot.json
wget -P ./flow_observer/bootstrap/public-root-information https://storage.googleapis.com/flow-genesis-bootstrap/mainnet-<spork version>-execution/public-root-information/root-protocol-state-snapshot.json.asc

  • In the same way, locate the most recent spork version in sporks.json for testnet and proceed to download the root-protocol-state-snapshot.json along with its corresponding signature file.

wget -P ./flow_observer/bootstrap/public-root-information https://storage.googleapis.com/flow-genesis-bootstrap/testnet-<spork version>/public-root-information/root-protocol-state-snapshot.json
wget -P ./flow_observer/bootstrap/public-root-information https://storage.googleapis.com/flow-genesis-bootstrap/testnet-<spork version>/public-root-information/root-protocol-state-snapshot.json.asc

Verify the PGP signature

Add the [email protected] public key

1gpg --keyserver keys.openpgp.org --search-keys [email protected]
2
3gpg: data source: http://keys.openpgp.org:11371
4(1) Flow Team (Flow Full Observer node snapshot verification master key) <
5   256 bit ECDSA key CB5264F7FD4CDD27, created: 2021-09-15
6Keys 1-1 of 1 for "[email protected]".  Enter number(s), N)ext, or Q)uit > 1

Verify the root-snapshot file

gpg --verify ./flow_observer/bootstrap/public-root-information/root-protocol-state-snapshot.json.asc
gpg: assuming signed data in 'bootstrap/public-root-information/root-protocol-state-snapshot.json'
gpg: Signature made Wed Sep 15 11:34:33 2021 PDT
gpg:                using ECDSA key 40CD95717AC463E61EE3B285B718CA310EDB542F
gpg: Good signature from "Flow Team (Flow Full Observer node snapshot verification master key) <[email protected]>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D23 8D1A E6D3 2A71 8ECD  8611 CB52 64F7 FD4C DD27
Subkey fingerprint: 40CD 9571 7AC4 63E6 1EE3  B285 B718 CA31 0EDB 542F

If you are not concerned about the blocks preceding the current block, you have the option to use the Flow CLI and request the current root-snapshot file via the Flow CLI.

For mainnet

flow snapshot save ./flow_observer/bootstrap/public-root-information/root-protocol-state-snapshot.json --host secure.mainnet.nodes.onflow.org:9001 --network-key 8a0d9edd0de3f15866dfe4aea1560c4504fe313fc6ca3f63a63e4f98d0e295144692a58ebe7f7894349198613f65b2d960abf99ec2625e247b1c78ba5bf2eae

For testnet

flow snapshot save ./flow_observer/bootstrap/public-root-information/root-protocol-state-snapshot.json --host secure.testnet.nodes.onflow.org:9001 --network-key ba69f7d2e82b9edf25b103c195cd371cf0cc047ef8884a9bbe331e62982d46daeebf836f7445a2ac16741013b192959d8ad26998aff12f2adc67a99e1eb2988d

Step 4: Start the node

You can run the observer node as a docker container.

Observer for Flow Mainnet

1docker run --rm \
2 -v $PWD/flow_observer/bootstrap:/bootstrap:ro  \
3 -v $PWD/flow_observer/data:/data:rw \
4 --name flow_observer \
5 -p 8071:8071 \
6 -p 3569:3569 \
7 -p 9000:9000 \
8 -p 9001:9001 \
9 gcr.io/flow-container-registry/observer:v0.27.2 \
10 --bootstrapdir=/bootstrap \
11 --datadir=/data/protocol \
12 --bind 0.0.0.0:3569  \
13 --loglevel=error \
14 --secretsdir=/data/secrets  \
15 --upstream-node-addresses=access-008.mainnet20.nodes.onflow.org:9001 \
16 --upstream-node-public-keys=11742552d21ac93da37ccda09661792977e2ca548a3b26d05f22a51ae1d99b9b75c8a9b3b40b38206b38951e98e4d145f0010f8942fd82ddf0fb1d670202264a \
17 --bootstrap-node-addresses=access-008.mainnet20.nodes.onflow.org:3570  \
18 --bootstrap-node-public-keys=11742552d21ac93da37ccda09661792977e2ca548a3b26d05f22a51ae1d99b9b75c8a9b3b40b38206b38951e98e4d145f0010f8942fd82ddf0fb1d670202264a \
19 --observer-networking-key-path=/bootstrap/network.key

Observer for Flow Testnet

1docker run --rm \
2 -v $PWD/flow_observer/bootstrap:/bootstrap:ro  \
3 -v $PWD/flow_observer/data:/data:rw \
4 --name flow_observer \
5 -p 8071:8071 \
6 -p 3569:3569 \
7 -p 9000:9000 \
8 -p 9001:9001 \
9 gcr.io/flow-container-registry/observer:v0.27.2 \
10 --bootstrapdir=/bootstrap \
11 --datadir=/data/protocol \
12 --bind 0.0.0.0:3569  \
13 --loglevel=error \
14 --secretsdir=/data/secrets  \
15 --upstream-node-addresses=access-003.devnet37.nodes.onflow.org:9001 \
16 --upstream-node-public-keys=b662102f4184fc1caeb2933cf87bba75cdd37758926584c0ce8a90549bb12ee0f9115111bbbb6acc2b889461208533369a91e8321eaf6bcb871a788ddd6bfbf7 \
17 --bootstrap-node-addresses=access-003.devnet37.nodes.onflow.org:3570  \
18 --bootstrap-node-public-keys=b662102f4184fc1caeb2933cf87bba75cdd37758926584c0ce8a90549bb12ee0f9115111bbbb6acc2b889461208533369a91e8321eaf6bcb871a788ddd6bfbf7 \
19 --observer-networking-key-path=/bootstrap/network.key

And there you have it! Your observer node is up and running, ready to witness the wonders of the Flow network. Happy exploring!