You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge #206: feat: add redb as an alternative to sqlite
83e6dd6 refactor: add docs,version and change visibility (codingp110)
7bcbcf0 feat: add redb as an alternative to sqlite (codingp110)
Pull request description:
<!-- You can erase any parts of this template not applicable to your Pull Request. -->
### Description
We currently only support `sqlite` persistence. This PR adds an alternative `redb` persistence by leveraging Summer Of Bitcoin work on [`bdk_redb`](https://github.com/110CodingP/bdk_redb).
<!-- Describe the purpose of this PR, what's being adding and/or fixed -->
### Notes to the reviewers
The CI does not pass since `bdk_redb` has a MSRV of 1.85.0 which is in turn due to `redb`. Also `bdk_redb` is yet to published as a crate so currently we use the GitHub version of the same.
The following script tests a simple scenario of creating a wallet with bitcoind-rpc as chain source , sending funds to an address controlled by the wallet and creating a transaction using the wallet:
```
rm -rf ~/.bitcoin/regtest
rm -rf ~/.bdk-bitcoin
bitcoin-cli -rpcuser=alice -rpcpassword=password createwallet alice
export NETWORK=regtest
export EXT_DESCRIPTOR=$(bitcoin-cli -rpcwallet=alice -rpcuser=alice -rpcpassword=password listdescriptors true | jq -r '.descriptors | .[0] | .desc')
export INT_DESCRIPTOR=$(bitcoin-cli -rpcwallet=alice -rpcuser=alice -rpcpassword=password listdescriptors true | jq -r '.descriptors | .[1] | .desc')
export DATABASE_TYPE=redb
export CLIENT_TYPE=rpc
export SERVER_URL=127.0.0.1:18443
addr=$(bdk-cli wallet -w alice -a alice:password new_address | jq -r '.address')
bitcoin-cli -rpcuser=alice -rpcpassword=password -rpcwallet=alice generatetoaddress 102 $addr
bdk-cli wallet -w alice -a alice:password full_scan
bdk-cli wallet -w alice -a alice:password balance
recipient=$(bitcoin-cli -rpcwallet=alice getrawchangeaddress)
psbt=$(bdk-cli wallet -w alice -a alice:password create_tx --to "$recipient:5000" | jq -r '.psbt')
signed_psbt=$(bdk-cli wallet -w alice -a alice:password sign $psbt | jq -r '.psbt')
bdk-cli wallet -w alice -a alice:password broadcast --psbt $signed_psbt
unset $addr
addr=$(bdk-cli wallet -w alice -a alice:password new_address | jq -r '.address')
bitcoin-cli -rpcuser=alice -rpcpassword=password -rpcwallet=alice generatetoaddress 1 $addr
bdk-cli wallet -w alice -a alice:password sync
bdk-cli wallet -w alice -a alice:password balance
```
the conf is as follows:
```
regtest=1
[regtest]
server=1
rpcuser=alice
rpcpassword=password
```
~~Also removed `sqlite` from default features since we now have an alternative.~~
<!-- In this section you can include notes directed to the reviewers, like explaining why some parts
of the PR were done in a specific way -->
## Changelog notice
<!-- Notice the release manager should include in the release tag message changelog -->
<!-- See https://keepachangelog.com/en/1.0.0/ for examples -->
### 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 (test is in the PR description)
* [x] I've added docs for the new feature
* [x] I've updated `CHANGELOG.md`
ACKs for top commit:
notmandatory:
utACK 83e6dd6
Tree-SHA512: 50481b0cc293437145c5b1c3671e21b4a2bed32733e86a05a3404e13b70c77bd04754c53411656c7e84a4fc6efcf92659949f2c02f2135fabb0612b010ef4861
0 commit comments