bitcoindevkit / bitcoindevkit/bdk_wallet
REDB backend
- Dominant language
- Rust
- Stars
- 59
- Forks
- 105
- Avg merge
- 10d 9h
- Merged PRs (30d)
- 1
Description
# Summer of Bitcoin Project Proposal
**Description**
Wallets built with the `bdk_wallet` library currently have two implementations of the `WalletPersister` trait: `sqlite` and `file_store`. It would be useful to add an alternative storage back-end implementation using `redb`, a pure-Rust key-value store.
**Expected Outcomes**
* Create a new `bdk_redb` crate similar to the `bdk_file_store` crate.
* Add an implementation of the [WalletPersister](https://docs.rs/bdk_wallet/latest/bdk_wallet/trait.WalletPersister.html) trait for the new `bdk_redb` data store.
* Add tests in `bdk_redb` and `bdk_wallet` to confirm data is accurately stored and retrieved.
* Add a new `bdk_wallet` feature called `redb` that enables the the `bdk_redb` implementation of `WalletPersister`.
* Create an example similar to `example_wallet_esplora_blocking` that demonstrates using `bdk_redb` instead of `file_store`.
**Resources**
- [bdk_wallet](https://github.com/bitcoindevkit/bdk/tree/master/crates/wallet)
- [bdk_file_store](https://github.com/bitcoindevkit/bdk/tree/master/crates/file_store)
- [rusqlite_impl.rs](https://github.com/bitcoindevkit/bdk/blob/master/crates/chain/src/rusqlite_impl.rs)
- [redb](https://github.com/cberner/redb/)
- [WalletPersister Trait](https://docs.rs/bdk_wallet/latest/bdk_wallet/trait.WalletPersister.html#foreign-impls)
- [example_wallet_esplora_blocking](https://github.com/bitcoindevkit/bdk/tree/master/example-crates/example_wallet_esplora_blocking)
- [mempool.space version of electrs](https://github.com/mempool/electrs)
**Skills Required**
- Experience with git. [Guide](https://git-scm.com/book/en/v2)
- Experience with rust. [First seven chapters of the book](https://doc.rust-lang.org/book/)
- Able to setup a local core node in regtest and testnet mode.
- Familiarity with database technologies like SQL and SQLite.
**Mentor(s)**
@notmandatory
**Difficulty**
Hard
**Competency Test**
* Install rust, compile and run all bdk examples and tests.
* Setup a local Bitcoin Core node daemon in regtest mode.
* Setup a local regtest esplora API server using the mempool.space version of `electrs`.
* Make a wallet with `example_wallet_esplora_blocking` example wallet and receive and send regtest bitcoin.
## Original Description
### Discussed in https://github.com/bitcoindevkit/bdk/discussions/691
Originally posted by **casey** July 30, 2022
[redb](https://github.com/cberner/redb/) is a pure-Rust key-value store, and would be a good candidate for an alternative back-end. It is secure against data loss in some cases which sled probably isn't. It is still alpha quality, and the on-disk format has not been finalized, so it might not be quite ready yet, but could be good to watch for the future.
I mention this because I had issues building a binary on a Linux box due to the SQLite backend, and I don't personally believe that sled is mature enough to be used for production workloads, so another option would be nice.
Contributor guide
Assessment
This issue has not been assessed yet.