bdk
bdk copied to clipboard
Implement `PrunedBlockchain` backend: RPC on pruned node
Current RpcBlockchain grants full access to transaction history, however, it requires a non-pruned node (a node storing the full blockchain, which at the time of writing is over 400GB).
However, by renouncing to a wallet full transaction history, it is still possible to compute the wallet balance and be able to spend without needing a non-pruned node.
The key to achieve that is using RPC method scantxoutset
Note: if someone want to turn this into a "summer-of-bitcoin" project is welcome
Summer of Bitcoin Project Proposal
Description
Current RpcBlockchain grants full access to transaction history, however, it requires a non-pruned node (a node storing the full blockchain, which at the time of writing is over 400GB).
However, even without a wallet's full transaction history it is still possible to compute the wallet balance and be able to spend with only a pruned core full node.
The key to achieve that is using RPC method scantxoutset
Expected Outcomes
- Implement
blockchain::rpc::PrunedRpcBlockchainandblockchain::rpc::PrunedRpcConfig. PrunedRpcBlockchainwill use corescantxoutsetRPC to compute wallet balances.PrunedRpcBlockchainwill create spending transactions with a pruned core full node.
Resources
Skills Required
- Experience with git. Guide
- Familiarity with rust. First seven chapters of the book
- Able to setup a local core node in regtest and testnet mode.
Mentor(s)
@afilini @RCasatta
Difficulty
Hard
Competency Test (optional)
- Install rust, compile and run all bdk examples and tests.
- Read through the BDK docs.
- Setup a local Bitcoin Core node daemon in Regtest mode.
- Make a dummy wallet with BDK with RPC blockchain.
- Familiarity with basic rust, should be able to write basic trait implementations on foreign structures.
We have discussed making the summer of bitcoin tasks a bit easier because most students don't have a lot of experience with Bitcoin or even git sometimes. Though, compared to the other tasks we have this seems relatively easy, so I'm adding the tag anyway..
@afilini and @RCasatta would one or both of your be willing to mentor this issue for Summer of Bitcoin? I put you both on it for now. 🙂
Imo we should take into consideration that "pruning" does not prune away transactions already found in the Core wallet, and that it is very simple to change a core node from non-pruned to pruned, and that it is also possible that a user will create a Core wallet very early on in bootstrap (even though pruning is enabled).
It would make sense in some cases to "reuse" the original RpcBlockchain for a pruned node. Imo an elegant implementation should take into consideration all possibilities.
Closing this in favor of a new issue based on changing new bdk_bitcoind_rpc crate.