These examples demonstrate the main features of some of Reth's crates and how to use them.
To run an example, use the command cargo run -p <example>
.
If you've got an example you'd like to see here, please feel free to open an
issue. Otherwise if you've got an example you'd like to add, please feel free
to make a PR!
Example |
Description |
In Memory State |
Illustrates an ExEx that tracks the plain state in memory |
Minimal |
Illustrates how to build a simple ExEx |
OP Bridge |
Illustrates an ExEx that decodes Optimism deposit and withdrawal receipts from L1 |
Rollup |
Illustrates a rollup ExEx that derives the state from L1 |
Discv5 as ExEx |
Illustrates an ExEx that runs discv5 discovery stack |
Example |
Description |
DB over RPC |
Illustrates how to run a standalone RPC server over a Rethdatabase instance |
Example |
Description |
DB access |
Illustrates how to access Reth's database in a separate process |
Example |
Description |
Standalone network |
Illustrates how to use the network as a standalone component |
Example |
Description |
Trace pending transactions |
Illustrates how to trace pending transactions as they arrive in the mempool |
Standalone txpool |
Illustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator |
Example |
Description |
Manual P2P |
Illustrates how to connect and communicate with a peer |
Polygon P2P |
Illustrates how to connect and communicate with a peer on Polygon |
BSC P2P |
Illustrates how to connect and communicate with a peer on Binance Smart Chain |
Example |
Description |
Beacon API SSE |
Illustrates how to subscribe to beacon chain events via SSE |