Commit 67011b3
committed
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: 50481b0cc293437145c5b1c3671e21b4a2bed32733e86a05a3404e13b70c77bd04754c53411656c7e84a4fc6efcf92659949f2c02f2135fabb0612b010ef4861File tree
8 files changed
+188
-23
lines changed- src
8 files changed
+188
-23
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
| |||
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
172 | | - | |
| 175 | + | |
173 | 176 | | |
174 | 177 | | |
175 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
| |||
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
| 58 | + | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
751 | 757 | | |
752 | 758 | | |
753 | 759 | | |
754 | | - | |
| 760 | + | |
| 761 | + | |
755 | 762 | | |
756 | | - | |
| 763 | + | |
757 | 764 | | |
758 | 765 | | |
759 | 766 | | |
760 | 767 | | |
761 | 768 | | |
762 | | - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
763 | 782 | | |
764 | 783 | | |
765 | 784 | | |
| |||
776 | 795 | | |
777 | 796 | | |
778 | 797 | | |
779 | | - | |
| 798 | + | |
780 | 799 | | |
781 | 800 | | |
782 | 801 | | |
| |||
792 | 811 | | |
793 | 812 | | |
794 | 813 | | |
795 | | - | |
| 814 | + | |
796 | 815 | | |
797 | 816 | | |
798 | 817 | | |
799 | | - | |
800 | | - | |
| 818 | + | |
801 | 819 | | |
802 | 820 | | |
| 821 | + | |
803 | 822 | | |
804 | 823 | | |
805 | 824 | | |
806 | | - | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
807 | 838 | | |
808 | 839 | | |
809 | 840 | | |
| |||
816 | 847 | | |
817 | 848 | | |
818 | 849 | | |
819 | | - | |
| 850 | + | |
820 | 851 | | |
821 | 852 | | |
822 | 853 | | |
| |||
840 | 871 | | |
841 | 872 | | |
842 | 873 | | |
843 | | - | |
| 874 | + | |
844 | 875 | | |
845 | 876 | | |
846 | 877 | | |
847 | 878 | | |
848 | 879 | | |
849 | | - | |
850 | | - | |
851 | | - | |
| 880 | + | |
852 | 881 | | |
853 | 882 | | |
| 883 | + | |
854 | 884 | | |
855 | 885 | | |
856 | 886 | | |
857 | | - | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
858 | 900 | | |
859 | 901 | | |
860 | 902 | | |
861 | 903 | | |
862 | 904 | | |
863 | | - | |
| 905 | + | |
864 | 906 | | |
865 | 907 | | |
866 | 908 | | |
| |||
880 | 922 | | |
881 | 923 | | |
882 | 924 | | |
883 | | - | |
| 925 | + | |
884 | 926 | | |
885 | 927 | | |
886 | 928 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments