• Stars
    star
    293
  • Rank 141,748 (Top 3 %)
  • Language
    Rust
  • Created about 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust RPC client library for the Bitcoin Core JSON-RPC API.

Status

Rust RPC client for Bitcoin Core JSON-RPC

This is a Rust RPC client library for calling the Bitcoin Core JSON-RPC API. It provides a layer of abstraction over rust-jsonrpc and makes it easier to talk to the Bitcoin JSON-RPC interface

This git package compiles into two crates.

  1. bitcoincore-rpc - contains an implementation of an rpc client that exposes the Bitcoin Core JSON-RPC APIs as rust functions.

  2. bitcoincore-rpc-json - contains rust data structures that represent the json responses from the Bitcoin Core JSON-RPC APIs. bitcoincore-rpc depends on this.

Usage

Given below is an example of how to connect to the Bitcoin Core JSON-RPC for a Bitcoin Core node running on localhost and print out the hash of the latest block.

It assumes that the node has password authentication setup, the RPC interface is enabled at port 8332 and the node is set up to accept RPC connections.

extern crate bitcoincore_rpc;

use bitcoincore_rpc::{Auth, Client, RpcApi};

fn main() {

    let rpc = Client::new("http://localhost:8332",
                          Auth::UserPass("<FILL RPC USERNAME>".to_string(),
                                         "<FILL RPC PASSWORD>".to_string())).unwrap();
    let best_block_hash = rpc.get_best_block_hash().unwrap();
    println!("best block hash: {}", best_block_hash);
}

See client/examples/ for more usage examples.

Supported Bitcoin Core Versions

The following versions are officially supported and automatically tested:

  • 0.18.0
  • 0.18.1
  • 0.19.0.1
  • 0.19.1
  • 0.20.0
  • 0.20.1
  • 0.21.0

Minimum Supported Rust Version (MSRV)

This library should always compile with any combination of features on Rust 1.41.1.

More Repositories

1

rust-bitcoin

Rust Bitcoin library
Rust
2,063
star
2

rust-miniscript

Support for Miniscript and Output Descriptors for rust-bitcoin
Rust
342
star
3

rust-secp256k1

Rust language bindings for Bitcoin secp256k1 library.
C
337
star
4

rust-wallet

*archived* Library for a Bitcoin Wallet
Rust
180
star
5

murmel

Bitcoin SPV client in Rust.
Rust
102
star
6

rust-bech32

Bech32 format encoding and decoding
Rust
94
star
7

rust-bip39

A Rust library for working with Bitcoin BIP-39 mnemonics
Rust
88
star
8

bitcoin_hashes

Simple library which implements a few hashes and does nothing else
Rust
66
star
9

hammersbald

Hammersbald is a fast embedded blockchain database
Rust
52
star
10

rust-bitcoinconsensus

Bitcoin's libbitcoinconsenus.a with Rust binding. Built from Bitcoin sources with cargo.
C++
46
star
11

bitcoind

Utility to launch a regtest bitcoind process in a rust test
Rust
34
star
12

rust-bip47

BIP47 implementation in Rust
Rust
26
star
13

rust-lightning-invoice

lightning BOLT 11 invoice implementation
Rust
20
star
14

rust-bech32-bitcoin

Encoding and decoding Segregated Witness addresses in Bech32 format
Rust
16
star
15

bip324

encrypted messages over the Bitcoin P2P Protocol
Rust
15
star
16

bip322

Implements BIP322 generic message signing and verification
Rust
14
star
17

constants

Constants used across Bitcoin libraries
Rust
8
star
18

hex-conservative

Hex crate with a conservative MSRV and dependency policy
Rust
7
star
19

rust-bitcoin-chain

In-Memory Bitcoin blockchain
Rust
5
star
20

www.rust-bitcoin.org

Web site source code
Shell
5
star
21

rust-bitcoin.github.io

SCSS
5
star
22

rust-bitcoind-json-rpc

Support for Bitcoin Core's JSON-RPC API
Rust
5
star
23

rust-bitcoin-maintainer-tools

Scripts, test vectors, and other things used by or across multiple repositories in the rust-bitcoin ecosystem.
Rust
5
star
24

workshop

Conference workshop material
HTML
2
star
25

rust-psbt-v0

Partially Signed Bitcoin Transaction Format - BIP-174
Rust
1
star