Project · Beginner · about 14 hours
A Rust command-line tool for chain data
Write a Rust CLI that queries an Ethereum JSON-RPC node for blocks and balances, parses the responses safely, and is covered by tests against recorded responses.
Skills:REST APIs and HTTP, Rust, Automated testing
Part of: Blockchain Developer
Brief
Rust is common in blockchain infrastructure. Build a small but solid tool that talks to a node, the kind of utility teams write constantly.
What to build
Create a Cargo project with a CLI argument parser and an HTTP client
Implement block, balance and recent-transactions subcommands using JSON-RPC methods such as eth_blockNumber, eth_getBlockByNumber and eth_getBalance
Convert hex quantities and wei to readable units without floating-point errors
Record real responses from Anvil and use them in unit tests, and add one integration test that starts Anvil
Handle timeouts, invalid addresses and node errors with clear messages and exit codes
Deliverables
Repository with
src/,tests/, recorded fixtures andREADME.md
How it is graded
Reviewers run the CLI against their own Anvil node and feed it invalid input.
Stretch
Add a watch mode that follows new blocks and prints transfers to a given address.
Deliverables
- A CLI with subcommands for block info, account balance and recent transactions of an address
- Typed parsing of JSON-RPC responses with clear errors for bad input and node failures
- Unit tests using recorded responses, and an integration test against a local Anvil node
- A README and release build instructions
How a reviewer grades it
| Criterion | Weight | What good looks like |
|---|---|---|
| Idiomatic Rust with Result-based error handling and no unwraps in library code | 30% | |
| JSON-RPC calls and unit conversions between wei, gwei and ether are correct | 25% | |
| Tests cover parsing, errors and a live local node | 30% | |
| Usable CLI and documentation | 15% |