11 releases (4 stable)
| 30.0.0 | Oct 10, 2025 |
|---|---|
| 29.1.2 | Sep 29, 2025 |
| 0.1.6 | Aug 30, 2025 |
| 0.1.2 | Jun 22, 2025 |
#7 in #integration-testing
186 downloads per month
1MB
14K
SLoC
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:
[dependencies]
bitcoin-rpc-midas = "30.0.0"
tokio = { version = "1.0", features = ["full"] }
And then the code:
use bitcoin_rpc_midas::*;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = BitcoinTestClient::new_with_network(Network::Regtest).await?;
let blockchain_info = client.getblockchaininfo().await?;
println!("Blockchain info:\n{:#?}", blockchain_info);
Ok(())
}
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.
Dependencies
~15–32MB
~426K SLoC