Rust library for interacting with Bitcoin Core over JSONRPC
  • Rust 98.7%
  • Shell 1.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tobin C. Harding ef65309f7e
All checks were successful
Audit / Security audit (push) Successful in 2m59s
Continuous integration / Verify - stable toolchain (push) Successful in 1m5s
Continuous integration / Format - nightly toolchain (push) Successful in 1m54s
Continuous integration / Docs (push) Successful in 2m37s
Continuous integration / Integration tests 0_17_2 - stable toolchain (push) Successful in 5m19s
Continuous integration / Integration tests 0_21_2 - stable toolchain (push) Successful in 4m48s
Continuous integration / Lint - nightly toolchain (push) Successful in 6m38s
Continuous integration / Integration tests 0_18_1 - stable toolchain (push) Successful in 5m42s
Continuous integration / Integration tests 23_2 - stable toolchain (push) Successful in 4m19s
Continuous integration / Integration tests 22_1 - stable toolchain (push) Successful in 4m39s
Continuous integration / Integration tests 0_19_1 - stable toolchain (push) Successful in 6m0s
Continuous integration / Integration tests 0_20_2 - stable toolchain (push) Successful in 5m44s
Continuous integration / Integration tests 24_2 - stable toolchain (push) Successful in 4m10s
Continuous integration / Integration tests 25_2 - stable toolchain (push) Successful in 4m35s
Continuous integration / Test Electrs bitcoind_22_1,bitcoind_download,electrs_0_10_6,download (push) Successful in 1m18s
Continuous integration / Integration tests 26_2 - stable toolchain (push) Successful in 4m5s
Continuous integration / Test Electrs bitcoind_22_1,bitcoind_download,electrs_0_8_10,download (push) Successful in 1m25s
Continuous integration / Test Electrs bitcoind_22_1,bitcoind_download,electrs_0_9_1,download (push) Successful in 1m14s
Continuous integration / Integration tests 27_2 - stable toolchain (push) Successful in 3m52s
Continuous integration / Integration tests 28_2 - stable toolchain (push) Successful in 4m11s
Continuous integration / Integration tests 29_0 - stable toolchain (push) Successful in 3m56s
Continuous integration / Test Electrs bitcoind_22_1,bitcoind_download,electrs_0_9_11,download (push) Successful in 1m12s
Continuous integration / Integration tests 30_2 - stable toolchain (push) Successful in 4m8s
Continuous integration / Integration tests 31_1 - stable toolchain (push) Successful in 3m50s
Continuous integration / Integration tests 31_0 - stable toolchain (push) Successful in 4m13s
Continuous integration / Test - nightly toolchain (minimal) (push) Successful in 15m36s
Continuous integration / Test - stable toolchain (recent) (push) Successful in 14m56s
Continuous integration / Test - nightly toolchain (recent) (push) Successful in 15m13s
Continuous integration / Test - stable toolchain (minimal) (push) Successful in 15m41s
Continuous integration / Test - msrv toolchain (minimal) (push) Successful in 17m12s
Continuous integration / Test - msrv toolchain (recent) (push) Successful in 17m34s
Continuous integration / Test Electrs no auto-download features (push) Successful in 8m25s
Merge rust-bitcoin/corepc#781: bitreq: Drop url dev-dependency
8ed305ea96 bitreq: Drop `url` dev-dependency (Elias Rohrer)

Pull request description:

  Closes #779.

  The parity tests compare our URL parser against the `url` crate, which
  pulls `idna` and a number of further transitive dependencies into both
  lock files just for testing.

  Drop the dependency along with the parity tests and the strategies only
  they used. The property tests and unit tests still cover our parser, and
  the separate fuzz crate retains the comparison against `url`.

  Regenerate both lock files, keeping openssl at 0.10.78 in the minimal
  one as regenerating it otherwise brings back affected versions.

ACKs for top commit:
  jamil:
    ACK 8ed305ea96
  tobin:
    ACK 8ed305ea96

Tree-SHA512: 3bf5d180377363aec26855fa4816359a6dae6d169791083e3911b7676157f5a4ce31954635be63ea33a31a9207b0c17c32d22265132b08bc452ea015107da011
2026-12-03 15:13:18 +11:00
.cargo Ignore inapplicable rand advisory 2026-11-16 15:54:44 +00:00
.forgejo ci: skip binary downloads for lint and docs 2026-11-27 13:40:40 +01:00
bitcoind bitcoind: bind ZMQ publishers to loopback only 2026-11-20 16:32:54 +01:00
bitreq bitreq: Drop url dev-dependency 2026-11-23 10:02:34 +01:00
client Prepare stack of releases 2026-11-16 08:57:31 +00:00
contrib Merge rust-bitcoin/corepc#763: Report RustSec advisories on Forgejo 2026-11-14 11:50:37 +11:00
electrsd Prepare stack of releases 2026-11-16 08:57:31 +00:00
fuzz deps: unify direct dependency floors 2026-11-10 15:38:49 -05:00
integration_test Fix two typos 2026-11-28 16:32:25 +05:30
jsonrpc Prepare stack of releases 2026-11-16 08:57:31 +00:00
regtest-client Prepare stack of releases 2026-11-16 08:57:31 +00:00
types Merge rust-bitcoin/corepc#768: types: use Wtxid for wallet wtxid fields 2026-11-19 15:02:11 +11:00
verify Fix two typos 2026-11-28 16:32:25 +05:30
.gitignore Import electrsd 2026-04-15 15:49:45 +10:00
Cargo-minimal.lock bitreq: Drop url dev-dependency 2026-11-23 10:02:34 +01:00
Cargo-recent.lock bitreq: Drop url dev-dependency 2026-11-23 10:02:34 +01:00
Cargo.toml cargo: make plain cargo test pass without downloaded daemons 2026-11-09 11:50:40 +00:00
clippy.toml ci: add rbmt metadata and lint configuration 2026-04-09 13:46:14 -03:00
CODEOWNERS Integrate corepc-regtest-client with tooling 2026-08-31 11:23:47 +05:30
justfile just: generate lockfiles with cargo rbmt lock 2026-11-10 15:38:49 -05:00
LICENSE Add initial implementation 2024-05-30 16:47:03 +10:00
nightly-version Update Github CI to rustc nightly-2025-09-12 2025-09-12 10:19:19 +01:00
notes.md Flesh out v17 and v18 2024-11-22 09:23:06 +11:00
README.md Fail on incomplete audit reports 2026-11-13 15:53:05 +00:00
rustfmt.toml chore: replaced deprecated 'version' option with 'style_edition' and update nightly version to 2025-04-04 2025-04-10 04:03:30 +01:00

Bitcoin Core JSON-RPC support

There are two primary purposes of this repository:

  1. Provide the corepc-types crate for use in production software.

  2. Provide tools for integration testing Rust code that interacts with the Bitcoin network. Primarily consumers of the rust-bitcoin library. And enable doing so against multiple versions of Bitcoin Core.

If you require a JSON RPC client in production software it is expected you write your own and only use the corepc-types crate in your dependency graph. Feel free to copy/steal/plagiarise or otherwise enjoy yourself with anything in this repository - no attribution required.

Contributing

PRs, feature requests, and bug reports against corepc-types most welcome and appreciated.

PRs, feature requests, and bug reports against the other crates welcome if you are using them for integration testing.

Please be considerate of reviewer time when using LLMs. We have the same AI tooling policy as LLVM: https://llvm.org/docs/AIToolPolicy.html

Please do not use corepc-regtest-client in production and raise bugs, issues, or feature requests.

Crate/directory listing

  • bitcoind/: bitcoind: Runs bitcoind regtest nodes.
  • bitreq/: bitreq: Simple, minimal-dependency HTTP client, with optional features for proxies, async, and https.
  • client/: corepc-client: Async JSON-RPC client for Bitcoin Core.
  • regtest-client/: corepc-regtest-client: Blocking JSON-RPC client for integration/regtest testing.
  • contrib/: Contains scripts including one to run local regtest bitcoind nodes using versions specified in the config file. A template config file and bitcoind aliases are in the subdirectory templates/
  • electrsd/: electrsd: Utility to run a regtest electrs process connected to a given bitcoind instance.
  • integration_test/: Integration tests that use corepc-client and bitcoind to test corepc-types.
  • jsonrpc/: jsonrpc: Rudimentary support for sending JSONRPC 2.0 requests and receiving responses.
  • types/: corepc-types: Rust types returned by the JSON-RPC API of Bitcoin Core.
  • verify/: Provides a tool to help verify the rest of the repository.

Design

This repository is a bit oddly designed. It was done so very intentionally. The aim is to provide data types for every single JSON RPC method provided by Core for many versions going back to v17. Furthermore we want to explicitly test every method call using every data structure to ensure we got it correct.

Fundamentally when you make an arbitrary RPC call against a miscellaneous Bitcoin Core instance you do not know which version of Core you are talking to. No crate in this repository makes any effort to solve this problem - it is left to the application. If however you want to run a specific RPC call against a specific version of Core this repository is your friend.

Original code

I don't know who is using bitcoind and/or rust-bitcoincore-rpc in the wild and I do not want to disrupt them. As such bitcoind was pulled in here with permission of the original author.

Some code shamelessly stolen from rust-bitcoincore-rpc (credit to Steven).

Minimum Supported Rust Version (MSRV)

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

Use Cargo-minimal.lock to build the MSRV by copying to Cargo.lock and building.

Security audit

Forgejo audits a freshly resolved lockfile and the minimal and recent lockfiles daily. The scheduled audit creates an issue for each RustSec advisory unless its ID already appears in the title of an issue or pull request, including closed ones. Yanked crates are reported in the audit log but do not create issues. The workflow fails if an audit report is empty or cannot be parsed.