Skip to content

Commit

Permalink
updated full node by default, staking, alpha6 etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bloxster committed Dec 12, 2024
1 parent 3af2c7a commit deee31a
Show file tree
Hide file tree
Showing 22 changed files with 256 additions and 165 deletions.
2 changes: 1 addition & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
---

- [Tools](tools.md)
- [Diagnostic Tool](tools/introduction.md)
- [Dagnostic Tools](tools/introduction.md)
- [Installation](tools/installation.md)
- [Setup](tools/setup.md)
- [User Interface](tools/user_interface.md)
Expand Down
102 changes: 84 additions & 18 deletions src/advanced/block-prod.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Block production

How to propose and validate blockswith Erigon
*How to propose and validate blocks with Erigon*

Only remote miners are supported.
Both remote miners and Caplin are supported.

To enable, add the flags:
# Using remote miners

To enable remote miners , add the flags:

```bash
--mine --miner.etherbase=...
Expand All @@ -15,37 +17,101 @@ or
--mine --miner.miner.sigkey=...
```

Other supported options: `--miner.extradata`, `--miner.notify`, `--miner.gaslimit`, `--miner.gasprice` , `--miner.gastarget`

JSON-RPC supports methods: `eth_coinbase` , `eth_hashrate`, `eth_mining`, `eth_getWork`, `eth_submitWork`, `eth_submitHashrate`
Other supported options are:
- `--miner.notify`: Comma separated HTTP URL list to notify of new work packages
- `--miner.gaslimit`: Target gas limit for mined blocks (default: `36000000`)
- `--miner.etherbase`: Public address for block mining rewards (default: "`0`")
- `--miner.extradata`: Block extra data set by the miner (default: `client version`)
- `--miner.noverify`: Disable remote sealing verification (default: `false`)
- `--miner.noverify`: Disable remote sealing verification (default: `false`)
- `--miner.sigfile`: Private key to sign blocks with
- `--miner.recommit`: Time interval to recreate the block being mined (default: `3s`)
- `--miner.gasprice`: This option sets the minimum gas price for mined transactions
- `--miner.gastarget`: This option sets the maximum amount of gas that could be spent during a transaction.

JSON-RPC supports websocket methods: `newPendingTransaction`
Erigon supports [standard JSON-RPC methods](https://ethereum.org/en/developers/docs/apis/json-rpc/).

# Using Caplin as validator
*Running Erigon with Caplin and Lighthouse Validator*

Caplin is also suitable for staking, however, you will need to utilize either Lighthouse, Teku, or another validator client as your key manager, since Caplin does not offer a native key management solution.

This guide explains how to use Erigon with its embedded Caplin consensus layer and Lighthouse as the validator client for staking on Ethereum.

## 1. Start Erigon with Caplin
Run the following command to start Erigon with the embedded Caplin consensus layer with the beacon API on:

```bash
erigon \
--datadir=/data/erigon \
--chain=mainnet \
--prune.mode=full \
--http \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api=engine,eth,net,web3 \
--ws \
--ws.port=8546 \
--caplin.enable-upnp \
--caplin.discovery.addr=0.0.0.0 \
--caplin.discovery.port=4000 \
--caplin.discovery.tcpport=4001 \
--chain=<NETWORK>
--beacon.api=beacon,validator,builder,config,debug,events,node,lighthouse
```

**Flags Explanation**:

<div class="warning">
- Execution Layer:
- `--http.api=engine,eth,net,web3`: enables the necessary APIs for external clients and Caplin.
- `--ws`: enables WebSocket-based communication (optional).
- Consensus Layer (Caplin):
- `--caplin.discovery.addr` and `--caplin.discovery.port`: configures Caplin's gossip and discovery layer.
- `--beacon.api=beacon,validator,builder,config,debug,events,node,lighthouse`: enables all possible API endpoints for the validator client.

**Information**
## 2. Set Up Lighthouse Validator Client

Only Lighthouse, Lodestar and Teku are supported as Validator Clients.
### 2.1 Install Lighthouse

</div>
Download the latest Lighthouse binary:

To enable block production and Caplin's beacon API when using Caplin as the Consensus Layer (CL) engine, the flag `--beacon.api` must be added. For example:
```
curl -LO https://github.com/sigp/lighthouse/releases/latest/download/lighthouse
chmod +x lighthouse
sudo mv lighthouse /usr/local/bin/
```

Or, use Docker:

```bash
--beacon.api=beacon,builder,config,debug,node,validator,lighthouse
docker pull sigp/lighthouse:latest
```
For example, if you want to run Erigon and Caplin as a validator here is an example of configuration:

### 2.2. Create Lighthouse Validator Key Directory

```bash
./build/bin/erigon --chain=holesky --prune.mode=full --beacon.api=beacon,builder,config,debug,node,validator,lighthouse
mkdir -p ~/.lighthouse/validators
```

While here the command for Lighthouse* would be:
### 2.3. Run Lighthouse Validator Client

Start the validator client and connect it to the Caplin consensus layer:
```bash
lighthouse vc \
--network mainnet \
--beacon-nodes http://127.0.0.1:5555 \
--suggested-fee-recipient=<your_eth_address>
```
**Flags Explanation**:
- `--network mainnet`: Specifies the Ethereum mainnet.
- `--beacon-nodes`: Points to the Caplin beacon API at `http://127.0.0.1:5555`.
- `--suggested-fee-recipient`: Specifies your Ethereum address for block rewards.

### 2.4. Import Validator Keys

If you have existing validator keys, import them:

```bash
lighthouse validator_client --network holesky --beacon-nodes http://localhost:5555
lighthouse account validator import --directory <path_to_validator_keys>
```

**For adding validators and specific command syntax, refer to the documentation of your chosen Validator Client.*
2 changes: 1 addition & 1 deletion src/advanced/caplin.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Caplin is enabled by default, at which point an external consensus layer is no l

Caplin also has an archive mode for historical states and blocks, which can be enabled with the `--caplin.archive` flag.

Caplin can also be used for [block production](/advanced/block-prod.md).
Caplin can also be used for [block production](/advanced/block-prod.md#using-caplin-as-validator), aka **staking**.
2 changes: 1 addition & 1 deletion src/advanced/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The Erigon 3 CLI has a wide range of flags that can be used to customize its beh

## Pruning Presets

* `--prune.mode`: Choose a pruning preset: `archive`, `full`, or `minimal` (default: `archive`) see also [Type of node](/basic/node.md)
* `--prune.mode`: Choose a pruning preset: `archive`, `full`, or `minimal` (default: `full`) see also [Type of node](/basic/node.md)
* `--prune.distance`: Keep state history for the latest N blocks (default: everything) (default: `0`)
* `--prune.distance.blocks`: Keep block history for the latest N blocks (default: everything) (default: `0`)

Expand Down
2 changes: 1 addition & 1 deletion src/advanced/consensus_layer.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The consensus client, also known as the *Beacon Node* or *CL client*, implements

**Information**

By default, Erigon is configured to run with Caplin, the embedded Consensus Layer.
By default, Erigon is configured to run with [Caplin](/advanced/caplin.md), the embedded Consensus Layer.
</div>

## Choosing the Consensus Layer client
Expand Down
39 changes: 22 additions & 17 deletions src/advanced/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ USAGE:
erigon [command] [flags]
VERSION:
3.00.0-alpha5-78f3647d
3.00.0-alpha6-f22317ef
COMMANDS:
init Bootstrap and initialize a new genesis block
import Import a blockchain file
snapshots, seg Managing snapshots (historical data partitions)
support Connect Erigon instance to a diagnostics system for support
help, h Shows a list of commands or help for one command
init Bootstrap and initialize a new genesis block
import Import a blockchain file
seg, snapshots, segments Managing historical data segments (partitions)
support Connect Erigon instance to a diagnostics system for support
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--datadir value Data directory for the databases (default: /home/admin/.local/share/erigon)
--ethash.dagdir value Directory to store the ethash mining DAGs (default: /home/admin/.local/share/erigon-ethash)
--datadir value Data directory for the databases (default: /root/.local/share/erigon)
--ethash.dagdir value Directory to store the ethash mining DAGs (default: /root/.local/share/erigon-ethash)
--externalcl Enables the external consensus layer (default: false)
--txpool.disable Experimental external pool and block producer, see ./cmd/txpool/readme.md for more info. Disabling internal txpool and block producer. (default: false)
--txpool.locals value Comma separated accounts to treat as locals (no flush, priority inclusion)
Expand All @@ -55,10 +55,10 @@ GLOBAL OPTIONS:
--txpool.commit.every value How often transactions should be committed to the storage (default: 15s)
--prune.distance value Keep state history for the latest N blocks (default: everything) (default: 0)
--prune.distance.blocks value Keep block history for the latest N blocks (default: everything) (default: 0)
--prune.mode value Choose a pruning preset to run onto. Available values: "archive","full","minimal".
Archive: Keep the entire indexed database, aka. no pruning. (Pruning is flexible),
Full: Keep only blocks and latest state (Pruning is not flexible)
Minimal: Keep only latest state (Pruning is not flexible) (default: "archive")
--prune.mode value Choose a pruning preset to run onto. Available values: "full", "archive", "minimal".
Full: Keep only blocks and latest state,
Archive: Keep the entire indexed database, aka. no pruning,
Minimal: Keep only latest state (default: "full")
--batchSize value Batch size for the execution stage (default: "512M")
--bodies.cache value Limit on the cache for block bodies (default: "268435456")
--database.verbosity value Enabling internal db logs. Very high verbosity levels may require recompile db. Default: 2, means warning. (default: 2)
Expand Down Expand Up @@ -93,7 +93,7 @@ GLOBAL OPTIONS:
--state.cache value Amount of data to store in StateCache (enabled if no --datadir set). Set 0 to disable StateCache. Defaults to 0MB (default: "0MB")
--rpc.batch.concurrency value Does limit amount of goroutines to process 1 batch request. Means 1 bach request can't overload server. 1 batch still can have unlimited amount of request (default: 2)
--rpc.streaming.disable Erigon has enabled json streaming for some heavy endpoints (like trace_*). It's a trade-off: greatly reduce amount of RAM (in some cases from 30GB to 30mb), but it produce invalid json format if error happened in the middle of streaming (because json is not streaming-friendly format) (default: false)
--db.read.concurrency value Does limit amount of parallel db reads. Default: equal to GOMAXPROCS (or number of CPU) (default: 768)
--db.read.concurrency value Does limit amount of parallel db reads. Default: equal to GOMAXPROCS (or number of CPU) (default: 1408)
--rpc.accessList value Specify granular (method-by-method) API allowlist
--trace.compat Bug for bug compatibility with OE for trace_ routines (default: false)
--rpc.gascap value Sets a cap on gas that can be used in eth_call/estimateGas (default: 50000000)
Expand Down Expand Up @@ -153,7 +153,7 @@ GLOBAL OPTIONS:
--bootnodes value Comma separated enode URLs for P2P discovery bootstrap
--staticpeers value Comma separated enode URLs to connect to
--trustedpeers value Comma separated enode URLs which are always allowed to connect, even above the peer limit
--maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 100)
--maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 32)
--chain value name of the network to join (default: "mainnet")
--dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
--vmdebug Record information useful for VM and contract debugging (default: false)
Expand All @@ -170,7 +170,7 @@ GLOBAL OPTIONS:
--mine Enable mining (default: false)
--proposer.disable Disables PoS proposer (default: false)
--miner.notify value Comma separated HTTP URL list to notify of new work packages
--miner.gaslimit value Target gas limit for mined blocks (default: 30000000)
--miner.gaslimit value Target gas limit for mined blocks (default: 36000000)
--miner.etherbase value Public address for block mining rewards (default: "0")
--miner.extradata value Block extra data set by the miner (default = client version)
--miner.noverify Disable remote sealing verification (default: false)
Expand Down Expand Up @@ -199,8 +199,12 @@ GLOBAL OPTIONS:
--caplin.discovery.port value Port for Caplin DISCV5 protocol (default: 4000)
--caplin.discovery.tcpport value TCP Port for Caplin DISCV5 protocol (default: 4001)
--caplin.checkpoint-sync-url value [ --caplin.checkpoint-sync-url value ] checkpoint sync endpoint
--caplin.subscibe-all-topics Subscribe to all gossip topics (default: false)
--caplin.max-peer-count value Max number of peers to connect (default: 128)
--caplin.subscribe-all-topics Subscribe to all gossip topics (default: false)
--caplin.max-peer-count value Max number of peers to connect (default: 80)
--caplin.enable-upnp Enable NAT porting for Caplin (default: false)
--caplin.max-inbound-traffic-per-peer value Max inbound traffic per second per peer (default: "256KB")
--caplin.max-outbound-traffic-per-peer value Max outbound traffic per second per peer (default: "256KB")
--caplin.adaptable-maximum-traffic-requirements Make the node adaptable to the maximum traffic requirement based on how many validators are being ran (default: true)
--sentinel.addr value Address for sentinel (default: "localhost")
--sentinel.port value Port for sentinel (default: 7777)
--sentinel.bootnodes value [ --sentinel.bootnodes value ] Comma separated enode URLs for P2P discovery bootstrap
Expand Down Expand Up @@ -242,6 +246,7 @@ GLOBAL OPTIONS:
--sync.loop.block.limit value Sets the maximum number of blocks to process per loop iteration (default: 5000)
--sync.loop.break.after value Sets the last stage of the sync loop to run
--sync.parallel-state-flushing Enables parallel state flushing (default: true)
--chaos.monkey Enable 'chaos monkey' to generate spontaneous network/consensus/etc failures. Use ONLY for testing (default: false)
--pprof Enable the pprof HTTP server (default: false)
--pprof.addr value pprof HTTP server listening interface (default: "127.0.0.1")
--pprof.port value pprof HTTP server listening port (default: 6060)
Expand Down
7 changes: 4 additions & 3 deletions src/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ The all-in-one client is the preferred option for most users:
./build/bin/erigon
```

This CLI command allows you to run an Ethereum archive node where every process is integrated and no special configuration is needed.
This CLI command allows you to run an Ethereum **full node ** where every process is integrated and no special configuration is needed.

The default Consensus Layer utilized is [Caplin](./advanced/caplin.md), the Erigon flagship embedded CL.

# Basic Configuration​

* Default data directory is `/home/admin/.local/share/erigon`. If you want to store Erigon files in a non-default location, add flag:

```bash
--datadir=<your_data_dir>
```

* Based on the [type of node](basic/node.md) you want to run you can add ```--prune.mode=full``` to run a full node or ```--prune.mode=minimal``` to run a minimal node.
* Based on the [type of node](basic/node.md) you want to run you can add ```--prune.mode=archive``` to run a archive node or ```--prune.mode=minimal``` for a minimal node.
The default node is archive node.
* ```--chain=mainnet```, add the flag `--chain=sepolia` for Sepolia testnet or `--chain=holesky` for Holesky testnet.
* ```--http.addr="0.0.0.0" --http.api=eth,web3,net,debug,trace,txpool``` to use RPC and e.g. be able to connect your [wallet](basic/wallet.md).
* To increase download speed add ```--torrent.download.rate=512mb``` (default is 16mb)
* To increase download speed add ```--torrent.download.rate=512mb``` (default is 16mb).

To stop the Erigon node you can use the ```CTRL+C``` command.

Expand Down
Loading

0 comments on commit deee31a

Please sign in to comment.