Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(book): basic pruning chapter #4334

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. [Metrics](./run/observability.md)
1. [Configuring Reth](./run/config.md)
1. [Transaction types](./run/transactions.md)
1. [Pruning](./run/pruning.md)
1. [Troubleshooting](./run/troubleshooting.md)
1. [Interacting with Reth over JSON-RPC](./jsonrpc/intro.md)
1. [eth](./jsonrpc/eth.md)
Expand Down
60 changes: 60 additions & 0 deletions book/run/pruning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Pruning

> WARNING: pruning and full node are experimental features of Reth,
> and available only on `main` branch of the main repository now.

By default, Reth runs as an archive node. Such nodes have all historical blocks and the state at each of these blocks
available for querying and tracing.

Reth also supports pruning of historical data and running as a full node. This chapter will walk through
the steps for running Reth as a full node, what caveats to expect and how to configure your own pruned node.
Comment on lines +9 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add how big the node is with various configs in followup


## Basic concepts

- Archive node – Reth node that has all historical data from genesis.
- Pruned node – Reth node that has its historical data pruned partially or fully through
a [custom configuration](./config.md#the-prune-section).
- Full Node – Reth node that has the latest state and historical data for only the last 128 blocks available
for querying in the same way as an archive node.

The node type that was chosen when first [running a node](./run-a-node.md) **can not** be changed after
the initial sync. Turning Archive into Pruned, or Pruned into Full is not supported.

## Modes
### Archive Node

Default mode, follow the steps from the previous chapter on [how to run on mainnet or official testnets](./mainnet.md).

### Full Node

To run Reth as a full node, follow the steps from the previous chapter on
[how to run on mainnet or official testnets](./mainnet.md), and add a `--full` flag. For example:
```bash
RUST_LOG=info reth node \
--full \
--authrpc.jwtsecret /path/to/secret \
--authrpc.addr 127.0.0.1 \
--authrpc.port 8551
```

### Pruned Node

To run Reth as a pruned node configured through a [custom configuration](./config.md#the-prune-section),
modify the `reth.toml` file and run Reth in the same way as archive node by following the steps from
the previous chapter on [how to run on mainnet or official testnets](./mainnet.md).

## RPC support

As it was mentioned in the [pruning configuration chapter](./config.md#the-prune-section), there are several parts
which can be pruned independently of each other:
- Sender Recovery
- Transaction Lookup
- Receipts
- Account History
- Storage History

Pruning of each of these parts disables different RPC methods, because the historical data or lookup indexes
become unavailable.

> TODO: `prune parts / RPC methods` table that shows which RPCs becomes unavailable when certain parts of the data
> are pruned
Comment on lines +59 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, we can do in follow-up, but for sure before alpha.8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should basically recommend some use-case driven example configs, for very very aggressive pruners e.g.

1 change: 1 addition & 0 deletions book/run/run-a-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ In this chapter we'll go through a few different topics you'll encounter when ru
1. [Logs and Observability](./observability.md)
1. [Configuring reth.toml](./config.md)
1. [Transaction types](./transactions.md)
1. [Pruning](./pruning.md)
1. [Troubleshooting](./troubleshooting.md)

In the future, we also intend to support the [OP Stack](https://stack.optimism.io/docs/understand/explainer/), which will allow you to run Reth as a Layer 2 client. More there soon!
Loading