{"id":20253256,"url":"https://github.com/rust-bitcoin/bitcoind","last_synced_at":"2025-12-12T16:32:14.679Z","repository":{"id":38948666,"uuid":"367105374","full_name":"rust-bitcoin/bitcoind","owner":"rust-bitcoin","description":"Utility to launch a regtest bitcoind process in a rust test","archived":false,"fork":false,"pushed_at":"2024-11-27T13:23:47.000Z","size":351,"stargazers_count":42,"open_issues_count":21,"forks_count":35,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-04T21:47:13.313Z","etag":null,"topics":["bitcoin","bitcoind","integration-testing","rust","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-bitcoin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-13T16:14:39.000Z","updated_at":"2025-01-05T06:57:51.000Z","dependencies_parsed_at":"2023-02-14T06:45:22.255Z","dependency_job_id":"a01ea8fe-a7be-459c-a4c6-fd4e441e5a4c","html_url":"https://github.com/rust-bitcoin/bitcoind","commit_stats":{"total_commits":195,"total_committers":17,"mean_commits":"11.470588235294118","dds":"0.20512820512820518","last_synced_commit":"2df19946422a3c7584f1f4b44ab55fa65bedc4b7"},"previous_names":["rcasatta/bitcoind"],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bitcoin%2Fbitcoind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bitcoin%2Fbitcoind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bitcoin%2Fbitcoind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-bitcoin%2Fbitcoind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-bitcoin","download_url":"https://codeload.github.com/rust-bitcoin/bitcoind/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247622983,"owners_count":20968575,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoind","integration-testing","rust","testing"],"created_at":"2024-11-14T10:22:46.469Z","updated_at":"2025-12-12T16:32:14.646Z","avatar_url":"https://github.com/rust-bitcoin.png","language":"Rust","readme":"**🚧 IMPORTANT 🚧**\n\nDevelopment of this repo has been [moved](https://github.com/rust-bitcoin/corepc/tree/master/node) 🚚.\nThe associated crate is [`corepc-node`](https://crates.io/crates/corepc-node)\nKeeping this for a while in case we need backport, then we are going to archive this.\n\n\n[![MIT license](https://img.shields.io/github/license/RCasatta/bitcoind)](https://github.com/RCasatta/bitcoind/blob/master/LICENSE)\n[![Crates](https://img.shields.io/crates/v/bitcoind.svg)](https://crates.io/crates/bitcoind)\n[![Docs](https://img.shields.io/badge/docs.rs-bitcoind-green)](https://docs.rs/bitcoind)\n\n# Bitcoind\n\nUtility to run a regtest bitcoind process, useful in integration testing environment.\n\nWhen the auto-download feature is selected by activating one of the version feature, such as `25_1`\nfor bitcoin core 25.1, starting a regtest node is as simple as that:\n\n```rust\n// the download feature is enabled whenever a specific version is enabled, for example `25_1` or `24_0_1`\n#[cfg(feature = \"download\")]\n{\n  use bitcoincore_rpc::RpcApi;\n  let bitcoind = bitcoind::BitcoinD::from_downloaded().unwrap();\n  assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);\n}\n```\n\nThe build script will automatically download the bitcoin core version 25.1 from [bitcoin core](https://bitcoincore.org),\nverify the hashes and place it in the build directory for this crate. If you wish to download from an \nalternate location, for example locally for CI, use the `BITCOIND_DOWNLOAD_ENDPOINT` env var.\n\nWhen you don't use the auto-download feature you have the following options:\n\n* have `bitcoind` executable in the `PATH`\n* provide the `bitcoind` executable via the `BITCOIND_EXE` env var\n\n```rust\nuse bitcoincore_rpc::RpcApi;\nif let Ok(exe_path) = bitcoind::exe_path() {\n  let bitcoind = bitcoind::BitcoinD::new(exe_path).unwrap();\n  assert_eq!(0, bitcoind.client.get_blockchain_info().unwrap().blocks);\n}\n```\n\nStartup options could be configured via the [`Conf`] struct using [`BitcoinD::with_conf`] or \n[`BitcoinD::from_downloaded_with_conf`]\n\n## Issues with traditional approach\n\nI used integration testing based on external bash script launching needed external processes, there \nare many issues with this approach like:\n\n* External script may interfere with local development environment [1](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/blob/200fc8247c1896709a673b82a89ca0da5e7aa2ce/integration_test/run.sh#L9)\n* Use of a single huge test to test everything [2](https://github.com/rust-bitcoin/rust-bitcoincore-rpc/blob/200fc8247c1896709a673b82a89ca0da5e7aa2ce/integration_test/src/main.rs#L122-L203)\n* If test are separated, a failing test may fail to leave a clean situation, causing other test to \nfail (because of the initial situation, not a real failure)\n* bash script are hard, especially support different OS and versions\n\n## Features\n\n  * It waits until bitcoind daemon become ready to accept RPC commands\n  * `bitcoind` use a temporary directory as datadir. You can specify the root of your temp directories \n  so that you have node's datadir in a RAM disk (eg `/dev/shm`)\n  * Free ports are asked to the OS. Since you can't reserve the given port, a low probability race \n  condition is still possible, for this reason the process is tried to be spawn 3 times with different\n  ports.\n  * The process is killed when the struct goes out of scope no matter how the test finishes\n  * Allows easy spawning of dependent processes like:\n    - [electrs](https://github.com/RCasatta/electrsd)\n    - [cln](https://github.com/RCasatta/lightningd)\n    - [elements](https://github.com/RCasatta/elementsd)\n\nThanks to these features every `#[test]` could easily run isolated with its own environment.\n\n## Doc\n\nTo build docs:\n\n```sh\nRUSTDOCFLAGS=\"--cfg docsrs\" cargo +nightly doc --features download,doc --open\n```\n\n## MSRV\n\nThe MSRV is 1.56.1 for version 0.35.*\n\nNote: to respect 1.56.1 MSRV you need to use and older version of some dependencies, in CI the below\ndependency versions are pinned:\n\n```sh\ncargo update\ncargo update -p tempfile --precise 3.3.0\ncargo update -p log --precise 0.4.18\n```\n\nPinning in `Cargo.toml` is avoided because it could cause\ncompilation issues downstream.\n\n## Nix\n\nFor reproducibility reasons, Nix build scripts cannot hit the internet, but the\nauto-download feature does exactly that. To successfully build under Nix the\nuser must provide the tarball locally and specify its location via the\n`BITCOIND_TARBALL_FILE` env var.\n\nAnother option is to specify the `BITCOIND_SKIP_DOWNLOAD` env var and provide the\nexecutable via the `PATH`.\n\nAlternatively, use the dep without auto-download feature.\n\n## Used by\n\n* [firma](https://github.com/RCasatta/firma/)\n* [payjoin](https://github.com/Kixunil/payjoin)\n* [rust-miniscript](https://github.com/rust-bitcoin/rust-miniscript/tree/4a3ba11c2fd5063be960741d557f3f7a28041e1f/bitcoind-tests)\n\n### Via bdk dependency\n\n* [gun](https://github.com/LLFourn/gun)\n\n### Via electrsd dependency:\n\n* [bdk](https://github.com/bitcoindevkit/bdk)\n* [BEWallet](https://github.com/LeoComandini/BEWallet)\n* [gdk rust](https://github.com/Blockstream/gdk/blob/master/subprojects/gdk_rust/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-bitcoin%2Fbitcoind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-bitcoin%2Fbitcoind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-bitcoin%2Fbitcoind/lists"}