Naar hoofdinhoud gaan

Help deze pagina te vertalen


Je bekijkt deze pagina in het Engels omdat we hem nog niet hebben vertaald. Help ons deze inhoud te vertalen.

Pagina vertalen

Geen bugs hier!🐛

Deze pagina wordt niet vertaald. We hebben deze pagina voorlopig bewust in het Engels laten staan.

This tutorial is out of date after the merge. Light nodes do not currently work on proof-of-stake, but are expected to ship soon.

How to run a light node with Geth

✍Brian Gu
📆4 maart 2022
⏱️4 minute read

Please note that Geth light clients can be very slow to find peers. This is because they rely on full-node operators volunteering themselves as light servers from which the light clients can request data. There are usually only a small number of light servers available.

Also, note that after The Merge, a Geth node alone will not be sufficient - a consensus client must be connected to it to track the head of the chain.

You may be interested in running an Ethereum node. One of the easiest ways to do so is by downloading, installing, and running Geth. With Geth, we can have a light node up and running in minutes.

A light client requires less than 400MB of storage whilst still allowing full interactivity with the Ethereum state. Light clients retrieve data from remote peers, so some queries may take longer to respond to than other sync modes.

For an explanation of the differences between the different sync modes, read our nodes and clients developer docs.

Install and run

First, install Geth.

After installing Geth, you can run an Ethereum node in "light" mode by running the following command in a Terminal window:

geth --syncmode light

Once launched, Geth will begin connecting to other nodes on Ethereum - known as "peers". The process of connecting to peers may take a while.

When your Geth node has enough peers, it will import headers from new blocks on the chain.

When new block headers no longer have an "age", Geth will be synced to the chain's head.

Stopping and restarting your node

You can stop your node at any time by pressing CTRL+C.

When restarting the node, Geth will take a few minutes to download block headers created since the node was last run.

Enable the HTTP-RPC server

Enabling the HTTP-RPC server lets you connect your Ethereum node to other software like wallets, browser extensions, or custom software libraries.

You can enable the HTTP-RPC server by running the following command when launching Geth:

geth --syncmode light --http

Once enabled, run curl This should report no error.

Allow remote connections

To allow remote hosts to connect to your node, launch Geth with the following command:

1geth --syncmode light --http --http.addr

Note: this assumes that there is no process blocking requests to your localhost, such as a firewall.

Geth JavaScript console

Geth has a built-in JavaScript console and a JavaScript API called web3js that you can use to interact with your node.

To use the JavaScript console run:

geth attach

This console allows direct interaction with Ethereum. For example, running the eth.blockNumber command will print the latest known block number.

Full web3js documentation

Mainnet and testnets

Geth runs your node on Ethereum Mainnet by default.

It is also possible to use Geth to run a node on one of the public test networks, by running one of the following commands in Terminal:

geth --syncmode light --rinkeby
geth --syncmode light --goerli

Where is the blockchain and EVM data stored?

The directory which Geth uses to store raw blockchain data depends on your operating system. Upon running Geth, look for a message that looks like this:

INFO [11-18|14:04:47] Allocated cache and file handles database=/Users/bgu/Library/Ethereum/testnet/geth/lightchaindata cache=768 handles=128

The path following “database=” should tell you where the blockchain data is stored on your machine. If you’re running a full node, this directory will contain all of the data about every block that has ever been committed to the blockchain. Since we’re running a light node, this directory only contains the block headers.

It’s worth emphasizing here that, at the lowest level, this is where the blockchain lives. The full contents of the blockchain and the EVM state are stored on every full node in the Ethereum network, in directories that look very much like the one on your computer.

Further reading

Laatst bewerkt: , Invalid DateTime
Pagina bewerken

Was deze pagina behulpzaam?

Website laatst bijgewerkt: 26 september 2022

Ethereum gebruiken

  • Zoek wallet
  • ETH verkrijgen
  • Gedecentraliseerde toepassingen (dapps)
  • Laag 2
  • Run een node
  • Stablecoins
  • Stake ETH


  • Community hub
  • Ethereum Foundation
  • Ethereum Foundation-blog
  • Ecosysteem Support Programma
  • Ethereum bug bounty-programma
  • Ecosysteem-subsidieprogramma's
  • Ethereum-merkcontent
  • Devcon