-
Notifications
You must be signed in to change notification settings - Fork 389
Add wallet creation example using RPC #519
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
Add wallet creation example using RPC #519
Conversation
0aa3d65
to
48a250a
Compare
Apparently I am not sure why thats not the case for other examples though (they also have special required deps). @notmandatory @afilini am I missing something in the cargo configuration? |
48a250a
to
5c0315a
Compare
Fixed build failure, all tests passing.. |
Trying to run this locally at the moment, but failing. What command should I run? |
@ConorOkus this should work |
tACK |
utACK does the example get run in the ci? |
I think currently it doesn't. But we can explicitly ask the CI to run examples I think. Haven't tried that out. |
I think it's ok if we just compile this example in the CI, I'm guessing what it does is already covered by specific unit tests |
I'm trying to do a similar thing in LDK here |
It's not as easy for BDK because different examples might require different features. So if you just compile them like you did, they will most likely fail. You would have to get the list of features from the |
Retested All looks good on this one to me.. Its good to go I think.. |
This example LGTM but I'm going hold off merging it until #535 goes in so it can be refactored as needed first. Also removing from next milestone since we're already a bit behind and have some higher priority PRs to get in. |
has this been massaged to accommodate new stuff in merged #535 |
Good point, This will definitely have effect on the example. Will update it accordingly.. |
I think this PR also needs a rebase to pick up the latest verify changes, in particular related to the CI Blockchain jobs. |
14cb771
to
a722c52
Compare
Fixed the example in light of #535 and rebased.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried testing but got an error, do I need to do something else to run it?:
% cargo run --features keys-bip39,key-value-db,rpc --example rpcwallet
warning: field is never read: `network`
--> src/blockchain/rpc.rs:58:5
|
58 | network: Network,
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `bdk` (lib) generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.07s
Running `target/debug/examples/rpcwallet`
>> Setting up bitcoind
>> bitcoind setup complete
Available coins in Core wallet : 50.00000000 BTC
>> Setting up BDK wallet
Error: Rpc(JsonRpc(Transport(Timeout)))
This adds an example wallet creation code with sled DB and RPC Blockchain. The backend RPC is managed using electrsd::bitcoind
a722c52
to
8a98e69
Compare
Thanks @notmandatory for the review.. I fixed the nits.
This seems very weird. Its not happening in my local. And it seems the error is originating from |
i get :
when i swap out in file
with Client invocation dance => instead of using :
the BDK wallet finds bitcoind and all is good ... While running a local regtest bitcoind with correct auth ... |
Thanks @xraid for reporting.. I am still not being able to reproduce any of the issues. Its all working fine in my local as normal. Did you mean you have to do the bitcoin core rpc setup manually instead of using |
the err says it blocks ? @afilini mentioned something about sharing connections to backends - that might not be the issue here, maybe it is the bitcoin.cookie in auth for the bdk-wallet ? i changed and used Client instead of the electrsd lines [50...75] line 103 reuse bitcoind object for bdk-wallet that was used for core-wallet prior i am still to fresh in Rust and the BDK code base to make any sense in try debug, so i leave it to You and meanwhile watch ... |
This should not be an issue because
In that case did you manually deploy the regtest node in the background? Ya I will keep digging to see if I can repro this.. |
2 similar comments
This should not be an issue because
In that case did you manually deploy the regtest node in the background? Ya I will keep digging to see if I can repro this.. |
This should not be an issue because
In that case did you manually deploy the regtest node in the background? Ya I will keep digging to see if I can repro this.. |
i run a local Nigiri regtest bitcoind electrum and used the
where i added auth and url in config :
so there is 2 diff connections to bitcoind rpc - one for core and one for bdk Why the example with using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 8a98e69
I verified this runs on my Linux (ubuntu 20.04) box. I'm still getting an error on my macOS system, but I suspect it's something specific to the mac. I'd like to know what's blocking it on the mac but not a reason to hold up this PR.
Description
As mentioned in bitcoindevkit/bitcoindevkit.org#83 (comment) it would be helpful
to have wallet creation example code in the
example
directory.This is an attempt to create the most simplistic bdk wallet with a RPC backend and demonstrate receiving, creating, signing
and broadcasting transaction.
The code is a refinement of the RPC tutorial https://bitcoindevkit.org/blog/bitcoin-core-rpc-demo/ with more elaborate doc comments.
Notes to the reviewers
To automate the background RPC process
electrsd
is used which is already adev-dependency
of bdk.Checklists
All Submissions:
cargo fmt
andcargo clippy
before committing