Skip to content

nervana21/bitcoin-rpc-midas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 = "0.1.6"
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.

About

A type-safe Bitcoin Core client that makes Bitcoin testing and development 10× easier.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages