You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With recent merge of #105. We have OPRETURN output creation in bdk-cli.. This can be covered in the integration tests in tests/integration.rs using the regtsts-* backend.
My plan is to add a focused integration test in tests/integration.rs covering OP_RETURN transaction creation through create_tx, using --add_string or --add_data, and then verify that the produced transaction contains the expected OP_RETURN output and payload.
Before you dive in, heads up on the current state of tests/integration.rs:
All existing tests are commented out lines 248–258 – there are zero working integration tests right now.
The test framework is outdated – it references old feature flags (regtest-bitcoin, regtest-electrum) that no longer exist, and uses CLI commands (get_new_address, get_balance, sync) that have since changed.
There's also been a discussion about moving away from shelling out to the binary in tests in favor of calling handler functions directly.
The main BDK repo has a solid test infrastructure - bdk_testenv crate that spins up bitcoind + electrs programmatically via the electrsd crate, with auto-download of binaries and cleanup on drop.
I'd suggest splitting this into two PRs:
PR 1: Set up a new test infrastructure - add bdk_testenv as a dev-dependency and write a basic integration test that calls handler functions directly (e.g. fund a wallet, check balance). This replaces the dead shell-based framework.
PR 2 (follow-up): Add the OP_RETURN test on top of that - call create_tx handler with add_string / add_data, verify the resulting transaction contains the expected OP_RETURN output and payload.
Would you be up for tackling PR 1 first? Let us know if you have any questions.
Thanks, that’s really helpful. I’m happy to take this on as two PRs:
PR 1: replace the dead shell-based integration test setup with a working test infrastructure
PR 2: add the OP_RETURN integration test on top of that
Before I start, I want to make sure I scope PR 1 the way you’d prefer:
Would you prefer the smallest possible setup for PR 1, meaning add bdk_testenv as a dev-dependency and get one basic funded-wallet integration test passing first, or should I shape the harness with multiple backends in mind from the start?
When you say “call handler functions directly,” would you like the tests to target the handler layer (handle_offline_wallet_subcommand / handle_online_wallet_subcommand), or go one level lower if that makes setup cleaner?
For PR 1, should I remove the dead shell-based framework in tests/integration.rs, or keep cleanup minimal and only replace enough of it to get the new path working?
For the first working test in PR 1, is a simple funded-wallet flow the right target (for example: fund wallet, sync, check balance / basic wallet operation), and then leave the OP_RETURN-specific assertions entirely for PR 2?
If that sounds good, I’ll proceed in those two steps.
Thanks, I’ve been assigned the issue and I’ll proceed with PR 1 first.
I’ll use bdk_testenv for the new harness, call the handler functions directly, and start with the basic funded-wallet flow as the first working test. I’ll keep the setup reusable so I can build the OP_RETURN coverage on top of it in PR 2.
I’ve opened PR 1 for the new integration test infrastructure here: https://github.com/bitcoindevkit/bdk-cli/pull/267\n\nThis PR sets up the -based harness, switches integration tests to call handlers directly, and adds the first funded-wallet flow test. I’ll follow up with PR 2 for the OP_RETURN-specific coverage on top of this foundation.
I’ve opened PR 1 for the new integration test infrastructure here: #267
This PR sets up the bdk_testenv-based harness, switches integration tests to call handlers directly, and adds the first funded-wallet flow test. I’ll follow up with PR 2 for the OP_RETURN-specific create_tx coverage on top of this foundation.
Activity
j-kon commentedon Apr 3, 2026
Hi, I’d like to work on this issue.
My plan is to add a focused integration test in
tests/integration.rscovering OP_RETURN transaction creation throughcreate_tx, using--add_stringor--add_data, and then verify that the produced transaction contains the expected OP_RETURN output and payload.If that sounds good, I’ll get started.
vadim-anfv commentedon Apr 3, 2026
Hey @j-kon, thanks for your interest!
Before you dive in, heads up on the current state of
tests/integration.rs:regtest-bitcoin,regtest-electrum) that no longer exist, and uses CLI commands (get_new_address,get_balance,sync) that have since changed.The main BDK repo has a solid test infrastructure -
bdk_testenvcrate that spins upbitcoind+electrsprogrammatically via theelectrsdcrate, with auto-download of binaries and cleanup on drop.I'd suggest splitting this into two PRs:
bdk_testenvas a dev-dependency and write a basic integration test that calls handler functions directly (e.g. fund a wallet, check balance). This replaces the dead shell-based framework.create_txhandler withadd_string/add_data, verify the resulting transaction contains the expected OP_RETURN output and payload.Would you be up for tackling PR 1 first? Let us know if you have any questions.
j-kon commentedon Apr 3, 2026
Thanks, that’s really helpful. I’m happy to take this on as two PRs:
Before I start, I want to make sure I scope PR 1 the way you’d prefer:
Would you prefer the smallest possible setup for PR 1, meaning add
bdk_testenvas a dev-dependency and get one basic funded-wallet integration test passing first, or should I shape the harness with multiple backends in mind from the start?When you say “call handler functions directly,” would you like the tests to target the handler layer (
handle_offline_wallet_subcommand/handle_online_wallet_subcommand), or go one level lower if that makes setup cleaner?For PR 1, should I remove the dead shell-based framework in
tests/integration.rs, or keep cleanup minimal and only replace enough of it to get the new path working?For the first working test in PR 1, is a simple funded-wallet flow the right target (for example: fund wallet, sync, check balance / basic wallet operation), and then leave the OP_RETURN-specific assertions entirely for PR 2?
If that sounds good, I’ll proceed in those two steps.
j-kon commentedon Apr 3, 2026
Also, just to make the implementation path explicit, here’s the plan I’m intending to follow for the two PRs.
PR 1
bdk_testenvas a dev-dependencybdk-clibinaryPR 2
create_txadd_stringand/oradd_dataThe goal is to keep PR 1 as small and foundational as possible, then layer the OP_RETURN-specific coverage in PR 2.
cc @va-an @tvpeter
tvpeter commentedon Apr 3, 2026
Using the
test_envis a good approach you can use.Similar to how you are going to test the
create_txsubcommand, you can test each subcommand as much as you can.The
testenv(if you are using it) provides you with a funded wallet. But when you start, you will get more clarity.j-kon commentedon Apr 3, 2026
Thanks, I’ve been assigned the issue and I’ll proceed with PR 1 first.
I’ll use
bdk_testenvfor the new harness, call the handler functions directly, and start with the basic funded-wallet flow as the first working test. I’ll keep the setup reusable so I can build the OP_RETURN coverage on top of it in PR 2.j-kon commentedon Apr 3, 2026
I’ve opened PR 1 for the new integration test infrastructure here: https://github.com/bitcoindevkit/bdk-cli/pull/267\n\nThis PR sets up the -based harness, switches integration tests to call handlers directly, and adds the first funded-wallet flow test. I’ll follow up with PR 2 for the OP_RETURN-specific coverage on top of this foundation.
j-kon commentedon Apr 3, 2026
I’ve opened PR 1 for the new integration test infrastructure here: #267
This PR sets up the
bdk_testenv-based harness, switches integration tests to call handlers directly, and adds the first funded-wallet flow test. I’ll follow up with PR 2 for the OP_RETURN-specificcreate_txcoverage on top of this foundation.tvpeter commentedon Jul 19, 2026
Closing this issue as resolved as some integration tests introduced in #289 covered this. Specifically, this test covered this issue.
Please feel free to reopen the issue if you think it was not properly addressed.