Light Client a.k.a Observer Node
A light client also known as the observer node is similar to an access node and provides a locally accessible, continuously updated, verified copy of the block data. It serves the gRPC Access API but unlike an access node, an light client does not need to be staked, and anyone can run it without being added to the approved list of nodes.
The light client bootstraps by connecting to an access node and becoming part of the public network comprised of access nodes and other light clients. It then continuously receives blocks that are being added to the chain either directly from the access node or from other light clients that are part of the public network. However, it makes no trust assumption of the upstream access node or the light client which is providing the block and locally verifies that the blocks that are received are the correct extension of the chain e.g. after receiving valid blocks A, B and C when it receives block D, it verifies that block D is indeed signed by the consensus nodes and is a valid next block. The received block data is indexed and made available via the Access API. For Collection, Transactions and Account queries, it delegates those requests to the upstream access node. Similarly, transactions and scripts sent to a light client are also forwarded to the upstream access node. Future versions of the light client will be able to serve this data locally as well.
Since the light client is not staked, it does not produce or execute blocks but instead serves as an unstaked access node that can be easily run on any consumer-grade computer which has enough disk space.
Who should run a light client?
The light client provides an alternative to running an access node. Hence, it is ideal for Dapps that need access to the latest block data available locally e.g. a wallet application that needs to track the latest block ID and height. In addition to that, access node operators who want to scale their access node endpoints geographically can spin up geographically dispersed light clients which can talk to their staked access node and to each other.
Running an light client
Hardware
In general, any consumer-grade computer with a decent network connection and sufficient disk space should be able to run a light client.
Minimum requirements
- CPU with 2+ cores
- 4 GB RAM minimum
- 300 GB SSD disk
- 10Mbps network connection
Steps to run a light client
Here is video walk-though of these 👇 steps.
Step 1 - Generate the node directory structure
The light client requires the following directory structure,
Create the parent and the sub-directories e.g.
Step 2 - Generate the network key
Like any other Flow node, the observer also needs a networking ECDSA key to talk to the network. Download the Bootstrapping kit, and generate the observer networking key.
If you are running on a mac, download the boot-tools for mac to generate the key
Step 3 - Download the root-protocol-state-snapshot.json file for the current spork
The root-protocol-state-snapshot.json
is generated for each spork and contains the genesis data for that spork.
It is published and made available after each spork. The download location is specified here under rootProtocolStateSnapshot and can be downloaded as follows,
For mainnet find the latest spork version from sporks.json and then download the root-protocol-state-snapshot.json
and the signature file for it.
Similarly, for testnet find the latest spork version from sporks.json and then download the root-protocol-state-snapshot.json
and the signature file for it.
Verify the PGP signature
Add the flow-signer@onflow.org
public key
Verify the root-snapshot file
Alternately, if you don't care about the blocks before the current block, you can request the current root-snapshot file via the Flow CLI.
For mainnet
For testnet
Step 4 - Start the node
The light client can be run as a docker container
Observer for Flow Mainnet
Observer for Flow Testnet
The light client acts as a DHT client and bootstraps from upstream access nodes which run the DHT server.
The upstream bootstrap server is specified using the bootstrap-node-addresses
which is the comma-separated list of hostnames of the access nodes.
The bootstrap-node-public-keys
is the list of the corresponding networking public key of those nodes.
The light client delegates many of the API calls to the upstream access nodes.
The upstream-node-addresses
is the list of access node hostnames to which this light client can delegate to. The list can be different from the bootstrap node list.
The bootstrap-node-public-key
is the list of the corresponding networking public key of those nodes.
In the above docker commands, the Flow community access nodes are being used as the upstream access nodes. However, any other Flow access node that supports a light client can be used
All parameters and their explanation can be found here
🚀 The node should now be up and running
You can now query the node for blocks, transaction etc. similar to how you would query an access node.
e.g. querying the gRPC API endpoint using Flow CLI
REST API is currently not support (see issue)
The light client, like the other type of Flow nodes, also produces Prometheus metrics that can be used to monitor node health. More on that here
FAQs
Does the light client need to be staked?
No, the light client is not a staked node.
Can any access node be used to bootstrap a light client?
No, only Access nodes which have explicitly turned ON support for light clients can be used to bootstrap a light client.
The public access nodes that support light clients are listed below. Apart from these, other public access nodes run by node operators other than the Flow foundation team may choose to support light clients.
How can an access node turn ON support for light client?
An access node can support a light client by passing in the following two parameters when starting the access node
public-network-address
is the address the light clients will connect to.
Are light clients subject to rate limits?
The observer serves all the Block related queries from is local database. These are not subjected to any rate limits.
However, it proxies all the other requests to the access node and those will be rate limited as per the rate limits defined on that access node.
Flow community access nodes that support connections from light clients
For mainnet
Access-007:
- Host:
access-007.[current mainnet spork].nodes.onflow.org
- Public Key:
28a0d9edd0de3f15866dfe4aea1560c4504fe313fc6ca3f63a63e4f98d0e295144692a58ebe7f7894349198613f65b2d960abf99ec2625e247b1c78ba5bf2eae
Access-008:
- Host:
access-008.[current mainnet spork].nodes.onflow.org
- Public Key:
11742552d21ac93da37ccda09661792977e2ca548a3b26d05f22a51ae1d99b9b75c8a9b3b40b38206b38951e98e4d145f0010f8942fd82ddf0fb1d670202264a
For testnet
Access-003:
- Host:
access-003.[current devnet spork].nodes.onflow.org
- Public Key:
b662102f4184fc1caeb2933cf87bba75cdd37758926584c0ce8a90549bb12ee0f9115111bbbb6acc2b889461208533369a91e8321eaf6bcb871a788ddd6bfbf7
Access-004:
- Host:
access-004.[current devnet spork].nodes.onflow.org
- Public Key:
0d1523612be854638b985fc658740fa55f009f3cd49b739961ab082dc91b178ed781ef5f66878613b4d34672039150abfd9c8cfdfe48c565bca053fa4db30bec
While the public keys remain the same, the hostnames change each spork to include the spork name. Substitute [current mainnet spork]
and [current devnet spork]
with the appropriate spork name (e.g. mainnet20
).
See Past Sporks for the current spork for each network.