Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test watch-only LND wallet and signing PSBT #87

Open
5 tasks
notmandatory opened this issue May 2, 2022 · 3 comments
Open
5 tasks

Test watch-only LND wallet and signing PSBT #87

notmandatory opened this issue May 2, 2022 · 3 comments
Assignees
Labels
discussion There's still a discussion ongoing

Comments

@notmandatory
Copy link
Member

This issue is to do a proof of concept test with BDK to confirm BDK can create a watch-only wallet to monitor the LND UTXOs and generate a PSBT that can be signed by LND. This idea is based on a discussion I had with @nicolasburtey and @bodymindarts about doing a BDK based wallet microservice for Galoy, initially for batching payments.

Goal of this test:

  • Setup regtest bitcoind with LND and BDK-CLI
  • Create LND on-chain wallet and load with test coins
  • Setup BDK-CLI wallet to watch LND on-chain wallet (xpub descriptor)
  • Create batch spending PSBT with BDK-CLI
  • Sign and spend BDK-CLI generated PSBT with LND on-chain wallet
@notmandatory notmandatory added the discussion There's still a discussion ongoing label May 2, 2022
@notmandatory notmandatory self-assigned this May 2, 2022
@notmandatory notmandatory moved this to Todo in BDK-CLI Roadmap May 2, 2022
@nicolasburtey
Copy link

thanks @notmandatory still on my todo to create the ticket. I guess some of the early context is here already, will write down the full spec of a potential batching service shortly.

@nicolasburtey
Copy link

could @sandipndev and @krtk6160 you look at this maybe?

@rajarshimaitra
Copy link
Contributor

rajarshimaitra commented May 11, 2022

I am interested in having this test too.. I am currently working on the final part of regtest-node feature where bdk-cli will be able to spawn a bitcoind and have rpc controller access to it.. In the same PR I am planning to include the integration test framework similar to #79. This will allow us to do programmatic integration testing for bdk-cli and whatever backend combinations we wanna use in rust code. Maybe LND will need a separate handler..

So @sandipndev @krtk6160 if you guys wanna mingle on this hit me up in discord. The approach of my current testframework will also depend on what you guys will need on this specific case..

And ideally we should have this test and all other similar types in CI too..

That will serve two purpose

  • Give example demo of how to use bdk-cli in various scenarios..
  • Ensure bdk-cli (in turn bdk) behaviors are maintained..

notmandatory added a commit that referenced this issue Sep 10, 2022
fa0454e Create node backend once in repl mode (Steve Myers)
322f6f1 Update changelog (rajarshimaitra)
0ce8426 Simplify main (rajarshimaitra)
4906764 Add the integration test framework (rajarshimaitra)
b596c9f Update utility (rajarshimaitra)
aa6a687 Update nodes.rs (rajarshimaitra)
0eb2dc8 Update handlers (rajarshimaitra)
0212b48 Update commands (rajarshimaitra)
992915b update cargo.toml (rajarshimaitra)

Pull request description:

  ### Description

  fixes #62
  fixes #76

  On the name :
  If Bitcoin wallet devs had to have a "calculator", this is what it might look like. One single interface to do all wallet and node operations.

  This PR does the following
   - Update electrsd to latest version. We need this to use it for out auto deployed backends.
   - Add the remaining codes to `nodes.rs` module to define basic node operation apis on the `Nodes` enum.
   - Add a new `node` command in ` CliSubCommand` which has its own subcommand `NodeSubCommand`, These subcommands are essentially `bitcoin-cli` calls. And only the basic ones are included so far. We can also compose multiple `bitcoin-cli` calls to create our own commands in future.
   - Update the `handlers` to handle newly added `NodeSubCommands`.
   - Update in `utils` :
     - This includes handling auto blockchain client creation for `regtest-*` features.
     -  update on the directory creation workflow. We are creating many directories for many stuffs, and I was trying to figure out the easiest way to keep the whole datadir struct intact, no matter where the user points its `datadir` to. Note that now `datadir` is a global app option, not just available for `regtest` nodes. Default `datadir` is the previous `~/.bdk-bitcoin`.
     - Finally add an integration test in `tests/integration.rs` that runs a basic wallet operation with a bdk-cli wallet connected to auto deployed regtest-bitcoin/electrum.

  ### Notes to the reviewers

  @sandipndev @krtk6160. I feel this PR is now ready to try out #87 .

  Also looking for more integration test ideas too add into.

  basic `node` usage looks like this
  ```
  $ ./target/debug/bdk-cli node --help
  bdk-cli-node 0.5.0
  Regtest Node mode

  USAGE:
      bdk-cli node <SUBCOMMAND>

  FLAGS:
      -h, --help
              Prints help information

      -V, --version
              Prints version information

  SUBCOMMANDS:
      generate         Generate blocks
      getbalance       Get Wallet balance
      getinfo          Get info
      getnewaddress    Get new address from node's test wallet
      help             Prints this message or the help of the given subcommand(s)
      sendtoaddress    Send to an external wallet address
  ```
  The biggest benefit is I think in the `repl` mode. That now kinda becomes an integrated tool the like python interpreter to operate a bdk-cli and a bitcoin backend from one single interface.

  I am excited to see what kind of demonstrations with bdk-cli we can create with this..

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk-cli/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature
  * [x] I've updated `CHANGELOG.md`

ACKs for top commit:
  notmandatory:
    tACK fa0454e

Tree-SHA512: 919abcee8291d5181c77cc1e53c630d013504861a5325ddf1d9fc8269db45afa91298852902dffafd576c19eae74e62f675ccba625055b6464c6d73a76a29913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion There's still a discussion ongoing
Projects
Status: Todo
Development

No branches or pull requests

3 participants