bitcoin-rpc-midas

Crates.iobitcoin-rpc-midas
lib.rsbitcoin-rpc-midas
version29.1.1
created_at2025-06-02 13:37:58.814364+00
updated_at2025-09-25 13:37:06.74947+00
descriptionGenerated client for Bitcoin Core v29.1.
homepagehttps://github.com/nervana21/bitcoin-rpc-midas
repositoryhttps://github.com/nervana21/bitcoin-rpc-midas
max_upload_size
id1697977
size1,029,678
(nervana21)

documentation

https://docs.rs/bitcoin-rpc-midas

README

Bitcoin-RPC-Midas

License: MIT Docs.rs crates.io

Type-safe Rust client for Bitcoin Core v29 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 calls
  • node/: Multi-network node management and test client support
  • test_node/: Integration testing helpers with embedded Bitcoin nodes
  • transport/: Async RPC transport with error handling and batching
  • types/: 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 = "29.1.1"
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.

Commit count: 15

cargo fmt