bitcoindevkit / bdk Goto Github PK
View Code? Open in Web Editor NEWA modern, lightweight, descriptor-based wallet library written in Rust!
License: Other
A modern, lightweight, descriptor-based wallet library written in Rust!
License: Other
I suggest adding this to the roadmap on the website.
Inspired by this tweet https://twitter.com/matt_odell/status/1286659125322162176?s=19
"All wallets should have the option to use your own node easily by simply scanning a QR code or pasting a connection code."
The BDK can build this and make it easy-to-use / default for any wallet based on BDK.
Create example code and blog post for how to use integrated rust tor client to sync bdk wallet with tor enabled blockchain service such as blockstream.info (http://explorerzydxu5ecjrkwceayqybizmpjjznk5izmitf2modhcusuqlid.onion/).
see:
https://github.com/MagicalBitcoin/libtor
https://gitlab.torproject.org/tpo/core/arti
This is an overview issue (based on same issue for murmel) for discussion and tracking the addition of a fully functional compact filters Blockchain backend to bdk
. Ideally we'll have additional issues and/or PRs for each missing feature to link to this issue and we check off each feature as it's completed.
The below BIP-157/158 protocol features are based on the BIP-157 Client Operation section. Please suggest additions and corrections in the comments.
Missing protocol features for bdk
are indicated below with an unchecked box [ ], completed features with a checked box [x].
Add a DNS based block data source to fetch block headers and block filters as described here: https://bitcoinheaders.net/
This would provide an alternative source of block data and way for a wallet to detect network censorship.
This may need to be moved or companion issues created in bdk-jni (and future bdk-ios) repos
Example:
use magical_bitcoin_wallet::descriptor::ExtendedDescriptor;
use std::str::FromStr;
fn main() {
let desc_str = "wsh(multi(1,[9d033c9d/48'/1'/0'/2']tpubDEHKJA6XKc6QaRvc5gunJY9T9cst9m1y8o2owqrvUmXK69ZjWySB7hgB6HvFdTp5MamaKYumSGxL49VUiEjWrhDE8N8BympFWDknLBEPG38/0/*,[6bb3d403/48'/1'/0'/2']tpubDDw2d4rKFtn5ECCq4KQ6GTi73YUQt3Wz2gqyv19kLAPJQKKKzNvEESi9v44sG4Fc6DsBuDgo5FQ9ZxbzQfV2X7jRvsBcT7N5s6g57xS4aUM/0/*))";
ExtendedDescriptor::from_str(&desc_str).unwrap();
}
Output:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Miniscript(Unexpected("multi(3 args) while parsing Miniscript"))', examples/magical.rs:6:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Here is where the error is being created in rust-miniscript. You can see a couple lines above that is where multi
should be handled, but it seems there hasn't been a rust-miniscript release since it was added.
Two related privacy features I'd like to see implemented in the future:
BDK should be able to provide blockchain and key services for the Lightning Development Kit (LDK). The LDK traits that need to be implemented by BDK are:
Some notes on providing support for lightning via EPS, but also relevant for making sure BDK can support Lightning clients.
Probably something like a "AnyBlockchain" type defined as an enum that internally matches
the blockchain variant.
Ideally it should be built using Box<dyn Blockchain>
but I'm not sure if those traits are object safe
We are currently discussing in rust-bitcoin how to model the PSBT workflow in rust. Bdk seems to be the most advanced rust wallet implementation so far. Do you have any opinion on rust-bitcoin/rust-bitcoin#457 for example? From what I read in the bdk docs I figure that my wallet trait might be too simple and not capturing UTXO selection parameters very well (something I thought to be intrinsic to a certain wallet impl). Your Signer
trait also seems more adapted to the real world as it differentiates between signing single inputs and whole transactions at once. Given your experience, do you think unifying the interface for PSBT handling is feasible (so that e.g. new HW wallet crates can be compatible with all PSBT aware rust software)?
Suggestion from @moneyball. Create a library that allows a light client to use the p2p network to monitor the mempool. today, the only way you can do this is with Core, which implies running a fully validating node. however, there is no reason you need to do IBD or validation in order to just monitor the mempool. why would a light client want to monitor the mempool?
See also
rust-bitcoin/murmel#37
ToWalletDescriptor
trait
&str
with and without checksum appended&str
with keys from the right/wrong networkdescriptor!()
macroMoved to #193
- [ ] Test the ExtractPolicy
trait
- [ ] Simple descriptors like wpkh()
, sh(multi())
- [ ] Both with extended and single keys
- [ ] More complicated descriptor that contains timelocks too in a thresh()
- [ ] Mixed timelocks should fail
- [ ] Multiple timelocks of the same type should be correctly merged together
Test the get_checksum()
function. It should return the same value as Bitcoin Core's getdescriptorinfo
Test the descriptor!()
macro
ToDescriptorKey
in multi()
or thresh()
valid_networks
returned is correctly computed based on the keys present in the descriptorkey_maps
are correctly merged togetherScriptContext
is correctly validated (i.e. passing a type that only impl ToDescriptorKey<Segwitv0>
to a pkh()
descriptor should throw a compilation errorTest the existing descriptor templates, make sure they are expanded to the right descriptors
something like
pub trait ConfigurableBlockchain: Blockchain {
type Config: Debug + Serialize + Deserialize;
fn from_config(source: Self::Config) -> Result<Self, Error>;
}
... and the same for the database
depends on bitcoindevkit/bdk-old#18
will support bdk-android
project
Generally need to think about how to prevent eclipse attacks for light clients that sync block headers from peers. Some ideas of strategies that can be borrowed from Bitcoin Core:
depends on bitcoindevkit/bdk-old#18
will support bdk-ios
project
For backing up wallet and seed data
See also https://github.com/photon-sdk
Seeing as you guys are a descriptor based wallet it would be really cool if you could support this wallet export/import format: https://github.com/Fonta1n3/FullyNoded/blob/master/Docs/Wallets.md
It is quite simple and is made possible by directly relying on Bitcoin Core descriptors. The functionality is live on Fully Noded and Specter-Desktop, hopefully more wallets will start to use this format as it offers an excellent way for users to backup, export and import wallets.
electrs is a bitcoin block chain index engine and HTTP API, implemented in Rust.
Implement block chain data source trait for electrs server REST API.
depends on bitcoindevkit/bdk-old#19
this is a place holder for alternative transports like:
Also make sure that they are run with https://doc.rust-lang.org/rustdoc/documentation-tests.html#include-items-only-when-collecting-doctests
Test all the backends with the #[bdk_blockchain_tests]
proc macro like we do with electrum in the CI. This could be done while transitioning to GitHub Actions (see #59).
I would use nigiri to have an electrs/esplora local instance, then a btcd node for compact filters.
Currently the CI downloads and runs the full node but that's pretty slow, we could make docker containers with everything preinstalled for it.
A docker image for electrs was added here: 98803b2
Seems to be much better integrated than travis
I suggest adding this to the roadmap on the website.
Inspired by this tweet https://twitter.com/matt_odell/status/1286659125322162176?s=19
"All wallets should have the option to use advanced coin control with labeling."
The BDK can build this and make it easy-to-use / default for any wallet based on BDK.
Another contributor suggested this as inspiration too: https://twitter.com/SifirApps/status/1269970305977585665
In several of the more cutting edge Bitcoin protocols you end up in a situation where there is a 2-of-2(A,B)
where Alice and Bob own the two keys respectively. Later on, one of the parties (let's say Alice) learns the secret key for B
through the execution of the protocol. Now Alice owns the output but needs to store and recall the secret key for B
and the details of the output.
I was thinking it would be nice for magical to manage this for me. What I think I want is to be able to add some kind of auxiliary descriptors to a wallet. The wallet could store it in its database and treat it like any of its other unspent outputs. Here are some considerations that come to mind:
get_balance
you're probably going to want to see how much of your balance is derived from the main descriptor and how much is from these transient descriptors. Likely you will want to "sweep" all of these in one go back to the main wallet descriptor.I was thinking about trying to implement something like this myself but wanted to check if you had an existing vision for this.
This is done manually now to have the ability to return "offline" instances for them (Blockchain::offline
), but it's complex and repetitive.
Starting with an empty ~/.magical-bitcoin
, it crashes if we provide a descriptor containing a checksum:
$ magic --descriptor "pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)#gn28ywm7" policies
...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ChecksumMismatch', examples/repl.rs:71:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Furthermore, a checksum for the entire checksummed descriptor is stored in sled, which causes a conflict when we try to provide the same valid descriptor without a checksum.
$ magic --descriptor "pk(0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798)" policies
...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ChecksumMismatch', examples/repl.rs:71:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
If we delete ~/.magical-bitcoin
and re-run the last command it will work.
I believe this line should check to see if the descriptor already contains a valid checksum.
This is a tracking issue for other issues and PRs related to supporting Taproot in BDK.
Overall rust-bitcoin org tracking project
Syncing again seems to fix it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.