bitcoin-rpc-midas
Type-safe Rust client for Bitcoin Core v30 RPCs, with test node support. Generated from a version-flexible toolchain.
Why Use This?
Compared to hand-written RPC clients, this toolchain offers:
- Reduced repetition
- Fewer versioning issues
- Increased compile-time checks
- Support for all Bitcoin p2p networks (mainnet, regtest, signet, testnet, and testnet4)
- Improved isolation from environment and port conflicts
Architecture
The crate is organized into focused modules:
client_trait/: Trait definitions for type-safe RPC method callsnode/: Multi-network node management and test client supporttest_node/: Integration testing helpers with embedded Bitcoin nodestransport/: Async RPC transport with error handling and batchingtypes/: Generated type definitions for all RPC responses
Example
This asynchronous example uses Tokio and enables some
optional features, so your Cargo.toml could look like this:
[]
= "30.0.0"
= { = "1.0", = ["full"] }
And then the code:
use *;
async
Requirements
Requires a working bitcoind executable.
About
This crate is generated by bitcoin-rpc-codegen, which systematically derives type-safe clients from Bitcoin Core's RPC specification. The generator ensures consistency, reduces duplication, and maintains alignment with upstream changes.
Contributing
Contributors are warmly welcome, see CONTRIBUTING.md.
License
Bitcoin RPC Code Generator is released under the terms of the MIT license. See LICENSE for more information or see https://opensource.org/license/MIT.
Security
This library communicates directly with bitcoind.
For mainnet use, audit the code carefully, restrict RPC access to trusted hosts, and avoid exposing RPC endpoints to untrusted networks.