Skip to content

Commit 412f353

Browse files
committed
Implementing proof of reserves
1 parent 9ff86ea commit 412f353

File tree

6 files changed

+619
-1
lines changed

6 files changed

+619
-1
lines changed

.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
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Proof of reserves
10+
- Added a separate module to construct "proof of reserve" PSBTs, and verify them.
11+
912
## [v0.8.0] - [v0.7.0]
1013

1114
### Wallet

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ cc = { version = ">=1.0.64", optional = true }
3131
socks = { version = "0.3", optional = true }
3232
lazy_static = { version = "1.4", optional = true }
3333
tiny-bip39 = { version = "^0.8", optional = true }
34+
bitcoinconsensus = { version = "0.19.0-3", optional = true }
35+
bitcoin_hashes = { version = "^0.9", optional = true }
36+
base64 = { version = "^0.11", optional = true }
3437

3538
# Needed by bdk_blockchain_tests macro
3639
bitcoincore-rpc = { version = "0.13", optional = true }
@@ -57,7 +60,7 @@ async-interface = ["async-trait"]
5760
all-keys = ["keys-bip39"]
5861
keys-bip39 = ["tiny-bip39"]
5962
rpc = ["bitcoincore-rpc"]
60-
63+
reserves = ["bitcoinconsensus", "bitcoin_hashes", "base64"]
6164

6265
# Debug/Test features
6366
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
@@ -72,6 +75,7 @@ env_logger = "0.7"
7275
clap = "2.33"
7376
serial_test = "0.4"
7477
bitcoind = "0.10.0"
78+
rstest = "^0.7"
7579

7680
[[example]]
7781
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)