Back to Reth

Examples

examples/README.md

2.2.05.1 KB
Original Source

Examples

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!

Node Builder

ExampleDescription
Additional RPC namespaceIllustrates how to add custom CLI parameters and set up a custom RPC namespace
Custom event hooksIllustrates how to hook to various node lifecycle events
Custom dev nodeIllustrates how to run a custom dev node programmatically and submit a transaction to it via RPC
Custom EVMIllustrates how to implement a node with a custom EVM
Custom Precompile CacheIllustrates how to implement a node with a stateful precompile cache
Custom inspectorIllustrates how to use a custom EVM inspector to trace new transactions
Custom engine typesIllustrates how to create a node with custom engine types
Custom node componentsIllustrates how to configure custom node components
Custom payload builderIllustrates how to use a custom payload builder

ExEx

See examples in a dedicated repository.

RPC

ExampleDescription
Custom auth HTTP middlewareIllustrates how to add HTTP transport middleware to the auth server for path-based request proxy
Custom RPC middlewareIllustrates how to add JSON-RPC layer middleware that alters RPC error responses
DB over RPCIllustrates how to run a standalone RPC server over a Reth database instance

Database

ExampleDescription
DB accessIllustrates how to access Reth's database in a separate process

Network

ExampleDescription
Standalone networkIllustrates how to use the network as a standalone component

Mempool

ExampleDescription
Trace pending transactionsIllustrates how to trace pending transactions as they arrive in the mempool
Standalone txpoolIllustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator

P2P

ExampleDescription
Manual P2PIllustrates how to connect and communicate with a peer
Polygon P2PIllustrates how to connect and communicate with a peer on Polygon
BSC P2PIllustrates how to connect and communicate with a peer on Binance Smart Chain

Misc

ExampleDescription
Beacon API SSEIllustrates how to subscribe to beacon chain events via SSE