Skip to content

Commit

Permalink
Implementing proof of reserves
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichard committed May 31, 2021
1 parent 881ca8d commit dff145e
Show file tree
Hide file tree
Showing 6 changed files with 619 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Cargo.lock

*.swp
.idea

.vscode/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Proof of reserves
- Added a separate module to construct "proof of reserve" PSBTs, and verify them.

### Wallet
- Added an option that must be explicitly enabled to allow signing using non-`SIGHASH_ALL` sighashes (#350)

Expand Down
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ cc = { version = ">=1.0.64", optional = true }
socks = { version = "0.3", optional = true }
lazy_static = { version = "1.4", optional = true }
tiny-bip39 = { version = "^0.8", optional = true }
bitcoinconsensus = { git = "https://github.com/rust-bitcoin/rust-bitcoinconsensus", branch = "master", optional = true }
bitcoin_hashes = { version = "^0.9", optional = true }
base64 = { version = "^0.11", optional = true }

# Needed by bdk_blockchain_tests macro
bitcoincore-rpc = { version = "0.13", optional = true }
Expand All @@ -56,6 +59,7 @@ key-value-db = ["sled"]
async-interface = ["async-trait"]
all-keys = ["keys-bip39"]
keys-bip39 = ["tiny-bip39"]
reserves = ["bitcoinconsensus", "bitcoin_hashes", "base64"]

# Debug/Test features
test-blockchains = ["bitcoincore-rpc", "electrum-client"]
Expand All @@ -67,6 +71,7 @@ env_logger = "0.7"
base64 = "^0.11"
clap = "2.33"
serial_test = "0.4"
rstest = "^0.7"

[[example]]
name = "address_validator"
Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ pub enum Error {
/// Required fee absolute value (satoshi)
required: u64,
},
/// The proof of reserves is invalid. The reason is given in the string parameter.
ProofOfReservesInvalid(String),
/// Cannot verify the proof.
CannotVerifyProof,
/// In order to use the [`TxBuilder::add_global_xpubs`] option every extended
/// key in the descriptor must either be a master key itself (having depth = 0) or have an
/// explicit origin provided
Expand Down
2 changes: 2 additions & 0 deletions src/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ use log::{debug, error, info, trace};
pub mod address_validator;
pub mod coin_selection;
pub mod export;
#[cfg(feature = "reserves")]
pub mod reserves;
pub mod signer;
pub mod time;
pub mod tx_builder;
Expand Down
Loading

0 comments on commit dff145e

Please sign in to comment.