20f394a452 random: add a commented-out test i used to run ENT (Antoine Poinsot)
157eea9893 lib: re-export the bip39 dependency (Antoine Poinsot)
50f13d3e2e signer: allow to the set the network for extended keys encoding (Antoine Poinsot)
f5e7632c73 signer: expose a method for signing a PSBT (Antoine Poinsot)
b88874107e signer: add a method to get the xpub at a given path (Antoine Poinsot)
59e55ae9f2 signer: implement mnemonics storage, and initialization from storage (Antoine Poinsot)
d341b6dea9 signer: cache the master xpriv (Antoine Poinsot)
6e3b951e54 signer: a new module with a BIP39-based hot signer (Antoine Poinsot)
Pull request description:
This introduces a new `signer` module. Its purpose is to provide clients of the Liana daemon (such as the GUI) with tools to sign transactions.
For now, the only signer available is a hot signer based on BIP39. It allows to generate new mnemonics from OS-provided randomness (with added randomness from the CPU if available and mixed-in contextual data). Mnemonics are stored in plaintext in a `mnemonics` folder at the root of a provided data directory.
Fixes#49.
ACKs for top commit:
edouardparis:
ACK 20f394a452
Tree-SHA512: 299476fdec69139cab9428e8466b4d320798ecd91a08251cac9d1fb086e43cffdb296eca4061a022a7182b5df2101977bb8300ead0d31f3f75988792145bba7f
https://www.fourmilab.ch/random/
Entropy = 8.000000 bits per byte.
Optimum compression would reduce the size
of this 912444480 byte file by 0 percent.
Chi square distribution for 912444480 samples is 254.09, and randomly
would exceed this value 50.43 percent of the times.
Arithmetic mean value of data bytes is 127.4952 (127.5 = random).
Monte Carlo value for Pi is 3.141641048 (error 0.00 percent).
Serial correlation coefficient is 0.000022 (totally uncorrelated = 0.0).
fcc1c21dbb descriptors: use the origin as xpub UID in partial spend info, not the fingerprint (Antoine Poinsot)
4af1a12a2a descriptors: fix the spending policy inference (Antoine Poinsot)
Pull request description:
The analysis was assuming missing that a `thresh(2, older(x), thresh(k, key1, key2, ..)` policy could be normalized to `thresh(k + 1, older(x), key1, key2, ..)` when `k == the number of keys` (i.e. in case of a N-of-N multisig). This also merges the analysis logic with the parsing check to make sure we don't introduce any inconsistency.
ACKs for top commit:
edouardparis:
utACK fcc1c21dbb
Tree-SHA512: d12db2ccf43d20fc85ea6f9fdfe2869948d2c63a2af22287c9133cf6f732fe92c7c0c63ba70ea3dfb0c910a93753ebd42cb168b4cf6bd6ccbed4e1cc7028b614
We were using the fingerprint as a stable unique identifier for xpubs in
a descriptor. It's not. For instance, what if a single signer is used
both in the primary and recovery path? The same fingerprint would appear
in both paths and we would mix up the signatures for both paths (ie if a
signature for each was provided, we would count each path as having 2
signatures).
3a573b695e qa: test we discard RBF'd deposits (Antoine Poinsot)
f1532f8afc bitcoin: track expired unconfirmed deposits, remove them from DB (Antoine Poinsot)
ed156543c9 database: permit to remove coins from DB (Antoine Poinsot)
62c4b9a01c bitcoind: cleanup gettx cache and conflict detection in spent_coins (Antoine Poinsot)
201c9f21b6 bitcoin: cache calls to 'gettransaction' when checking for coins confirmation (Antoine Poinsot)
13214c887f qa: test we discard RBF'd deposits when replacement is confirmed (Antoine Poinsot)
Pull request description:
Previously we would not detect whether the transaction for an unconfirmed deposit was still in our mempool. For instance a deposit that was RBF'd would result in us storing two coins, the replaced and the replacement. Keeping the unconfirmed replaced coin forever.
Fix this by dropping unconfirmed coins from our database if their transaction isn't in our mempool (anymore).
Fixes#72.
ACKs for top commit:
edouardparis:
utACK 3a573b695e
Tree-SHA512: 677bedbf8024eb16e5f97264c2e01d733732673548772fc3a97868b9ca42a0429ad8c0d888b05d3bb2db9b85d309c418b916c9af578f54e499b5d0689376a1b0
This is the same logic as the (cleaner) one we introduced in
confirmed_coins. Merge the two in a single CachedTxGetter, unfortunaly
at the expense of having to clone() the GetTxRes for now because i don't
want to fight with the borrow checker.
It would be possible for users to create a descriptor with xpubs without
an origin set. In fact, not many are used to origins and it's a very
likely mistake. Signers need this information in order to be able to
sign. So they could potentially create a wallet and potentially never be
able to sign for one or multiple keys.
Fix this by requiring an origin for all keys in the descriptor.
We were checking the bitcoind version *after* trying to create a
watchonly wallet with a Miniscript descriptor, which defeats the purpose
of the check.
Fixes#284.
We only allow to create "legacy" multisigs for now (that is, what fits
in a CHECKMULTISIG, ie k-of-n with n<=20). See
https://github.com/wizardsardine/liana/issues/53 for discussions around
this.
We are a bit more laxist on parsing, where any miniscript that
corresponds to a multisig policy will be accepted.
Note this makes the helper inferring the CSV value from semantic policy
incorrect, but this is fix in a later commit as part of a complete
refactor of this logic.
Multiple change indexes may be present in a spend
draft transaction and can be detected instead
in the response psbt with the bip32_derivation
outputs fields.
48e4909e7a daemon: store the watchonly wallet file in bitcoind's datadir on Windows (Antoine Poinsot)
Pull request description:
Turns out that providing an absolute path to bitcoind when loading a wallet on Windows results in surprising behaviour.
ACKs for top commit:
edouardparis:
ACK 48e4909e7a
Tree-SHA512: b432460d529cf5b879361452af1e7947ec877c293f8a8a2e1740975a2957c0cdb288d1f9a1fa07e56193c7c65edf1f985d9e24dd3412f2bfc10922df239de766
ba994ff8ff commands: do not underestimate the size of created transactions (Antoine Poinsot)
46a94d6c8e qa: test recovery 'sweep' transaction creation (Antoine Poinsot)
3b5cbd5122 qa: introduce a sign_and_broadcast utility (Antoine Poinsot)
d362885b85 qa: record the recovery xpub too (Antoine Poinsot)
a69fb625ea qa: use a CSV of 10 for recovery (Antoine Poinsot)
a78f46fa2f [refactoring] jsonrpc: sort command names alphabetically (Antoine Poinsot)
c09ae3f87b commands, jsonrpc: add a new 'createrecovery' command (Antoine Poinsot)
3d5d0134b4 commands: fix the capacity of input vectors in create_spend (Antoine Poinsot)
f2312593da commands: check for dust outputs in the PSBT sanity checks (Antoine Poinsot)
9f23161a53 commands: correct the max feerate value (Antoine Poinsot)
54410cd9c4 database: allow to query coins by their spending status (Antoine Poinsot)
Pull request description:
A new command that provides a simple way for a user to sweep all the coins whose timelocked recovery path is available.
The first part of #180. Note this also contains a number of drive-by fixes that i noticed while coding this up.
ACKs for top commit:
darosior:
self-ACK ba994ff8ff -- tested by Edouard on the GUI
Tree-SHA512: 002cb8602370fe3bec0692fe7bbe9e7af494b43756d3092da99b37e4ce2837bcdfcfb3afe7043900eb41c70de12e2129e19363b9efe41cee91c7f1f7c2824fb0
acd6929831 doc: update for bitcoind 24.0.1 release (Antoine Poinsot)
650101525d bitcoind: set minimum required version to 24.0 (Antoine Poinsot)
9211d849c1 bitcoind: be less stupid when loading the watchonly wallet (Antoine Poinsot)
Pull request description:
Fixes#210Fixes#209Fixes#213
ACKs for top commit:
darosior:
self-ACK acd6929831
Tree-SHA512: 8cacf41b0e00faed877462dc57b595265ff2936937d45535d1be2b42fd1bf80df2928ccacbefd43f82d88a728aca898a8549899380e341de8b8e74d34ec74642
This is a new command dedicated to the recovery usecase. For now it's
dead simple: sweep all coins that are available through the recovery
path to a given address.