A {regtest} bitcoin node runner 🏃‍♂️
  • Rust 88.2%
  • Python 6%
  • Shell 4.9%
  • Just 0.9%
Find a file
merge-script 50c9f937d2
Merge luisschwab/halfin#105: Automated Rust Toolchain Update 2026-07-08-be74
58f6a2161f chore(cargo): update nightly toolchain to nightly-2026-07-07 (Reduction-Oxidation Clanker)

Pull request description:

  ## Changelog
  ```
  - Update Nightly toolchain from nightly-2026-06-30 to nightly-2026-07-07
  ```

ACKs for top commit:
  luisschwab:
    ACK 58f6a2161f

Tree-SHA512: 5ae12cf6f69620ddba2ebf8524a65427cbac307b062f6ab1fcd104ee28f6fc4f8c2212ce1391f5d4a41d6d8ab6f4f5f8b4dc2968f62c84864b53f80e27a5aeb2
2026-07-08 11:17:10 -03:00
.cargo chore(deps): bump bitreq to v0.3.6 and tempfile to v3.27.0 2026-05-27 01:24:05 -03:00
.github chore(ci): install Python3.10 so ElectrumX can run 2026-07-01 15:50:18 -03:00
contrib fix(electrumx): also kill the underlying electrumx process on Drop 2026-07-01 20:34:46 -03:00
sha256 fix(electrumx): also kill the underlying electrumx process on Drop 2026-07-01 20:34:46 -03:00
src fix(electrumx): also kill the underlying electrumx process on Drop 2026-07-01 20:34:46 -03:00
static feat(doc): add bitcoin node runner picture 2026-04-18 13:52:53 -03:00
tests fix(electrumx): pass -DCMAKE_CXX_FLAGS=-frtti for Linux builds 2026-07-01 16:54:53 -03:00
.gitignore feat(electrumx): add ElectrumxD 2026-07-01 15:50:08 -03:00
build.rs fix(build): make cache-invalidation more agressive 2026-07-01 16:34:24 -03:00
Cargo-minimal.lock chore(cargo): bump version to v0.5.0 2026-07-01 17:52:08 -03:00
Cargo-recent.lock chore(cargo): bump version to v0.5.0 2026-07-01 17:52:08 -03:00
Cargo.toml chore(cargo): update nightly toolchain to nightly-2026-07-07 2026-07-08 13:55:54 +00:00
CHANGELOG.md fix(electrumx): also kill the underlying electrumx process on Drop 2026-07-01 20:34:46 -03:00
justfile feat(ci): use cargo rbmt tools for audit and zizmor 2026-06-24 15:14:01 -03:00
LICENSE-APACHE chore(doc): relicense MIT/Apache-2.0 2026-04-13 11:11:27 -03:00
LICENSE-MIT chore(doc): relicense MIT/Apache-2.0 2026-04-13 11:11:27 -03:00
rbmt-version chore(ci): bump cargo-rbmt to v0.4.1 2026-06-24 14:42:03 -03:00
README.md feat(electrumx): add ElectrumxD 2026-07-01 15:50:08 -03:00

A Bitcoin Node Runner (Hal Finney)

halfin

A {regtest} bitcoin node and indexer runner 🏃‍♂️

This crate makes it simple to run regtest bitcoind, utreexod, electrs, and electrumx instances from Rust code, useful in integration test contexts.

Supported Implementations

Kind Implementation Version Feature Flag Default Feature
Node bitcoind v31.0 bitcoind Yes
Node utreexod v0.6.0 utreexod Yes
Indexer electrs v0.11.1 electrs No
Indexer electrumx v1.20.0 electrumx No

Binaries are downloaded automatically at build time: see build.rs.

BitcoinD

use halfin::connect;
use halfin::bitcoind::BitcoinD;

// Use a downloaded binary
let bitcoind_alpha = BitcoinD::new().unwrap();

// Use a local binary
let bin_path = PathBuf::from_str("/usr/local/bin/bitcoind").unwrap();
let bitcoind_beta = BitcoinD::from_bin(&bin_path).unwrap();

// Connect peers
connect(&bitcoind_alpha, &bitcoind_beta).unwrap()

// Mine blocks
bitcoind_alpha.generate(100).unwrap();
assert_eq!(bitcoind_alpha.get_chain_tip().unwrap(), 100);

// Wait for a node to catch up with the other
wait_for_height(&bitcoind_beta, 100).unwrap();
assert_eq!(bitcoind_beta.get_chain_tip().unwrap(), 100);

ElectrsD

use halfin::bitcoind::BitcoinD;
use halfin::electrsd::ElectrsD;

let bitcoind = BitcoinD::new().unwrap();
bitcoind.generate(100).unwrap();

let electrs = ElectrsD::new(&bitcoind).unwrap();
electrs.wait_until_caught_up(&bitcoind, None).unwrap();

UtreexoD

use halfin::utreexod::UtreexoD;

// Use a downloaded binary
let utreexod = UtreexoD::new().unwrap();

// Mine blocks
utreexod.generate(100).unwrap();
assert_eq!(utreexod.get_chain_tip().unwrap(), 100);

// Perform a raw RPC call
let res = utreexod.call("uptime", &[]).unwrap();

Developing

This project uses just for command running, and cargo-rbmt to manage everything related to cargo, such as formatting, linting, testing and CI. To install them, run:

~$ cargo install just

~$ cargo install cargo-rbmt

A justfile is provided for convenience. Run just to see available commands:

~$ just
> halfin
> A regtest runner for `bitcoind` and `utreexod`

Available recipes:
    audit      # Run `cargo audit` on all lockfiles and prune ignored advisories [alias: a]
    build      # Build `halfin` [alias: b]
    check      # Check code formatting, compilation, and linting [alias: c]
    check-sigs # Checks whether all commits in this branch are signed [alias: cs]
    doc        # Generate documentation [alias: d]
    doc-open   # Generate and open documentation [alias: do]
    fmt        # Format code [alias: f]
    lock       # Regenerate Cargo-recent.lock and Cargo-minimal.lock [alias: l]
    pre-push   # Run pre-push checks [alias: p]
    shellcheck # Run ShellCheck [alias: sc]
    test       # Run tests with relevant toolchain and lockfile combinations [alias: t]
    toolchains # Install and/or Update `cargo-rbmt` and Stable and Nightly toolchains
    zizmor     # Run Zizmor Static Analysis [alias: z]

Minimum Supported Rust Version

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

To build with the MSRV toolchain, copy Cargo-minimal.lock to Cargo.lock.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.