light-client

Initialize and manage an Ethereum beacon chain light client for tracking finalized and optimistic headers.

2.3k|744|Updated Nov 23, 2015
One-click install
npx skills add https://github.com/Nethereum/Nethereum --skill light-client
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: light-client
Source: https://github.com/Nethereum/Nethereum/tree/main/plugins/nethereum-skills/skills/light-client
Command: npx skills add https://github.com/Nethereum/Nethereum --skill light-client

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Nethereum.Beaconchain, Nethereum.Consensus.LightClient, Nethereum.Signer.Bls.Herumi.

What problem does it solve?

Tracking the Ethereum consensus layer normally requires running a full node, which is resource-intensive. This Skill helps you initialize and manage a beacon chain light client in .NET that verifies sync committee BLS aggregate signatures to obtain trusted finalized and optimistic execution-layer headers without downloading every block.

Core Features & Use Cases

  • Light Client Initialization: Bootstrap a light client from a weak subjectivity root using Nethereum.Beaconchain, Nethereum.Consensus.LightClient, and Herumi BLS verification, with preset configs for Mainnet, Sepolia, and Holesky.
  • Update Lifecycle Management: Sync committee period catch-up via UpdateAsync, finalized header advancement via UpdateFinalityAsync, and near-head optimistic updates via UpdateOptimisticAsync.
  • Trusted Header Provider: Expose ITrustedHeaderProvider with staleness detection, stale-header events, and historical block hash lookup for consumption by state proof verification.
  • State Persistence: Implement ILightClientStore (e.g., file-based) to persist light client state across restarts and avoid re-bootstrapping.
  • Use Case: Build a wallet or indexer that verifies account balances via eth_getProof against a trusted finalized header without operating a full Ethereum node.

Quick Start

Initialize an Ethereum mainnet light client connected to a public beacon API endpoint and print the latest finalized block number and state root.

Frequently Asked Questions about light-client

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I initialize an Ethereum beacon chain light client in .NET?

Create a BeaconApiClient pointing to a beacon API endpoint, fetch the weak subjectivity root from the latest finality update, build a LightClientConfig with the genesis validators root and fork version, initialize Herumi BLS, then call InitializeAsync on LightClientService.

How do I keep a light client synced with the beacon chain?

Call UpdateAsync at startup or after being offline more than one sync committee period (~27 hours), UpdateFinalityAsync every few minutes for finalized headers, and UpdateOptimisticAsync every 12 seconds if near-head data is needed.

What is the difference between a light client and verified state in Nethereum?

The light client manages consensus tracking itself: sync committees, BLS verification, and header freshness. The verified-state skill consumes ITrustedHeaderProvider to verify balances, nonces, and storage via eth_getProof, but does not manage the light client lifecycle.

Which chains does the Nethereum light client support?

It supports Mainnet (chain ID 1), Sepolia (11155111), and Holesky (17000), each with a known genesis validators root. The CurrentForkVersion changes with each hard fork and should be fetched dynamically from the beacon API.

Why does my light client header become stale after inactivity?

If the client is offline for more than one sync committee period (~27 hours), the stored committee no longer matches the chain. Call UpdateAsync to catch up on sync committee periods before requesting finality or optimistic updates.

Can I persist light client state across application restarts?

Yes, implement the ILightClientStore interface with LoadAsync and SaveAsync methods, for example a file-based store serializing LightClientState to JSON. InMemoryLightClientStore is provided only for testing.