Skip to content

Commit 98fbd03

Browse files
committed
Implementing proof of reserves
1 parent e5d4994 commit 98fbd03

6 files changed

Lines changed: 618 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ Cargo.lock
33

44
*.swp
55
.idea
6+
7+
.vscode/

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Bitcoin core RPC added as blockchain backend
1212
- Add a `verify` feature that can be enable to verify the unconfirmed txs we download against the consensus rules
1313

14+
### Proof of reserves
15+
- Added a separate module to construct "proof of reserve" PSBTs, and verify them.
16+
1417
## [v0.8.0] - [v0.7.0]
1518

1619
### Wallet

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ socks = { version = "0.3", optional = true }
3232
lazy_static = { version = "1.4", optional = true }
3333
tiny-bip39 = { version = "^0.8", optional = true }
3434
bitcoinconsensus = { version = "0.19.0-3", optional = true }
35+
bitcoin_hashes = { version = "^0.9", optional = true }
36+
base64 = { version = "^0.11", optional = true }
3537

3638
# Needed by bdk_blockchain_tests macro
3739
bitcoincore-rpc = { version = "0.13", optional = true }
@@ -59,7 +61,7 @@ async-interface = ["async-trait"]
5961
all-keys = ["keys-bip39"]
6062
keys-bip39 = ["tiny-bip39"]
6163
rpc = ["bitcoincore-rpc"]
62-
64+
reserves = ["bitcoinconsensus", "bitcoin_hashes", "base64"]
6365

6466
# Debug/Test features
6567
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
@@ -74,6 +76,7 @@ env_logger = "0.7"
7476
clap = "2.33"
7577
serial_test = "0.4"
7678
bitcoind = "0.10.0"
79+
rstest = "^0.7"
7780

7881
[[example]]
7982
name = "address_validator"

src/error.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ pub enum Error {
6767
},
6868
/// Node doesn't have data to estimate a fee rate
6969
FeeRateUnavailable,
70+
/// The proof of reserves is invalid. The reason is given in the string parameter.
71+
ProofOfReservesInvalid(String),
72+
/// Cannot verify the proof.
73+
CannotVerifyProof,
7074
/// In order to use the [`TxBuilder::add_global_xpubs`] option every extended
7175
/// key in the descriptor must either be a master key itself (having depth = 0) or have an
7276
/// explicit origin provided

src/wallet/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ use log::{debug, error, info, trace};
3838
pub mod address_validator;
3939
pub mod coin_selection;
4040
pub mod export;
41+
#[cfg(feature = "reserves")]
42+
pub mod reserves;
4143
pub mod signer;
4244
pub mod time;
4345
pub mod tx_builder;

0 commit comments

Comments
 (0)