Commit graph

412 commits

Author SHA1 Message Date
Steven Roose
691040a63d
Add SIGHASH_RANGEPROOF support 2021-02-22 15:19:09 +00:00
Steven Roose
fdba8c45f9
Support descriptors with checksums in initpegoutwallet 2019-09-30 15:50:27 +02:00
Gregory Sanders
809f4acd3b Dynafed blocks must have sighash byte
It is not included in the signature hash.
The sighash byte MUST be SIGHASH_ALL to avoid
malleability.
2019-09-27 14:43:50 -04:00
Gregory Sanders
4aa5f991f4 Refactor block_proof to support dynafed 2019-09-03 10:50:16 -04:00
Gregory Sanders
1ccb0b67f9
Merge #610: All peg-out related detection pushes should be <= OP_PUSHDATA4
cff50f5 All peg-out related detection pushes should be <= OP_PUSHDATA4 (Gregory Sanders)

Pull request description:

  related to https://github.com/ElementsProject/elements/issues/598 , https://github.com/ElementsProject/elements/issues/596, https://github.com/ElementsProject/elements/pull/597

  This does not affect consensus, but affects consumers of these parsing rules such as rust-elements.

  cc @apoelstra @roconnor-blockstream

Tree-SHA512: 4ab6f0be52c3804b2af43c7b3eecbbe8f2868d3f33385dc54f3acb0e441188018a2b3df197801f2c20fa96e224b6acacb642ecf2f030227618e0aea1e2da44ea
2019-06-05 11:28:27 +02:00
Steven Roose
52f6f6905b
WIP: Fix compilation after merge 2019-05-20 16:22:05 +01:00
Steven Roose
f4889a5253
UPSTREAM MERGE BROKEN: Merge upstream commit '519b0bc5dc' into master 2019-05-17 16:17:09 +01:00
Gregory Sanders
cff50f5c36 All peg-out related detection pushes should be <= OP_PUSHDATA4 2019-05-07 21:23:49 -04:00
Steven Roose
7f894ae00b
UPSTREAM MERGE BROKEN: Merge commit 'f617e05c38' into master 2019-05-01 19:18:18 +01:00
Steven Roose
aba54b3f92
Make validatepegin default to true if has parent chain 2019-03-21 17:55:02 +00:00
Gregory Sanders
665d9ebe0e Whitespace and tab linting 2019-03-20 11:19:07 -04:00
Steven Roose
0b5066143d
[BROKEN] Add CA validation 2019-03-20 12:05:46 +00:00
Steven Roose
17a22f1495
Add support for blinded addresses 2019-03-20 12:05:34 +00:00
Gregory Sanders
aa375e66c1
Replace CScriptID and CKeyID in CTxDestination with dedicated type 2019-03-20 12:05:31 +00:00
Wladimir J. van der Laan
f60d029a2a
Merge #15368: Descriptor checksums
fd637be8d2 Add checksums to descriptors.md (Pieter Wuille)
be62903c41 Make descriptor checksums mandatory in deriveaddresses and importmulti (Pieter Wuille)
b52cb63688 Add getdescriptorinfo to compute checksum (Pieter Wuille)
3b40bff988 Descriptor checksum (Pieter Wuille)

Pull request description:

  This adds support for a descriptor-specific 8-character checksum.

  Descriptors may optionally be suffixed with a `#` plus these 8 checksum characters. Any descriptor that contains a `#` at the end must be followed by a valid checksum. If the `#` is missing entirely, it is valid without checksum.

  All RPCs are updated to report descriptors that include the checksum. On input, they are optional except in `deriveaddress` and `importmulti`, which require descriptors which include a checksum.

  A new RPC is also added to analyse descriptors (`getdescriptorinfo`), which can be used to compute the checksum for a descriptor without.

Tree-SHA512: a8294b09155eb6c67fbc178b5e2d3fbc0e9bec8b6de57a13f8835550d51c2cb32a428b3c9a188ded42b454d594e9305edbd4797906b755de77a8f33c79165f6b
2019-02-16 21:39:32 +01:00
Wladimir J. van der Laan
d5b929c813
Merge #13932: Additional utility RPCs for PSBT
540729ef4b Implement analyzepsbt RPC and tests (Andrew Chow)
77542cf2a5 Move PSBT UTXO fetching to a separate method (Andrew Chow)
cb40b3abd4 Figure out what is missing during signing (Andrew Chow)
08f749c914 Implement joinpsbts RPC and tests (Andrew Chow)
7344a7b998 Implement utxoupdatepsbt RPC and tests (Andrew Chow)

Pull request description:

  This PR adds 3 new utility RPCs for interacting with PSBTs.

  `utxoupdatepsbt` updates a PSBT with UTXO information from the node. It only works with witness UTXOs because full transactions (as would be needed for non-witness UTXOs) are not available unless txindex is enabled.

  `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. e.g. if PSBT 1 has inputs 1 and 2, and PSBT 2 has inputs 3 and 4, `joinpsbts` would create a new PSBT with inputs 1, 2, 3, and 4.

  `analyzepsbt` analyzes a PSBT and determines the current state of it and all of its inputs, and the next step that needs to be done.

Tree-SHA512: 3c1fa302201abca76a8901d0c2be7b4ccbce334d989533c215f8b3e50e22f2f018ce6209544b26789f58f5980a253c0655111e1e20d47d5656e0414c64891a5c
2019-02-16 20:45:03 +01:00
Pieter Wuille
3b40bff988 Descriptor checksum 2019-02-15 22:36:05 -08:00
Andrew Chow
cb40b3abd4 Figure out what is missing during signing
When signing an input, figure out what was requested for but was unable
to be found and store it in a SignatureData.

Return this information in SignPSBTInput.
2019-02-16 00:04:27 -05:00
Andrew Chow
eab63bc264 Store key origin info in key metadata
Store the master key fingerprint and derivation path in the
key metadata. hdKeypath is kept to indicate the seed and for
backwards compatibility, but all key derivation path output
uses the key origin info instead of hdKeypath.
2019-02-14 17:58:25 -05:00
Andrew Chow
e7652d3f64 Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp}
Creates new files util/bip32.h and util/bip32.cpp for containing
BIP 32 stuff.
Moves FormatKeyPath from descriptor.cpp to util/bip32.
Adds a wrapper around it to prepent the 'm' for when just the
BIP 32 style keypath is needed.
2019-02-14 14:00:28 -05:00
Steven Roose
fb72ee8fc8 Add Elements-style witness serialization 2019-02-13 11:42:38 +00:00
Glenn Willen
c6c3d42a7d Move PSBT definitions and code to separate files
Move non-wallet PSBT code to src/psbt.{h,cpp}, and PSBT wallet code to
src/wallet/psbtwallet.{h,cpp}. This commit contains only code movement (and
adjustments to includes and Makefile.am.)
2019-02-11 12:23:14 -08:00
Gregory Sanders
51584e73a3 MERGE-FIX: various compilation fixes 2019-01-28 18:14:40 +00:00
Gregory Sanders
c62fab2d69 UPSTREAM MERGE BROKEN: Merge commit '3832c25f17' into merge_14225 2019-01-28 18:14:25 +00:00
Pieter Wuille
11e0fd8d66 Descriptor expansions only need pubkey entries for PKH/WPKH 2019-01-25 10:39:06 -08:00
Steven Roose
4d70732d16
Merge #497: [0.17] Add Liquid v1 based script matching functionality
592a622b4 Add detection of liquidv1 fedpeg script, startup sanity check (Gregory Sanders)

Pull request description:

  And use it to sanity check startup constants.

Tree-SHA512: 1e4c3910c5c269384b5dab7a3f38646356a8de7684515324320d610915466e5015e9993d7a2a619473ea3500f3f9145526414548d6da6ee22b4417b6836042bf
2019-01-24 19:25:10 +00:00
Gregory Sanders
592a622b4b Add detection of liquidv1 fedpeg script, startup sanity check 2019-01-24 13:24:08 -05:00
Gregory Sanders
07173d02f4 Merge branch 'elements-0.17' into merge_13968 2019-01-24 12:51:19 -05:00
Steven Roose
9308a7f388
Merge #484: [0.17] PAK Enforcement, as policy
19ef5e3cb Add link to pak authorization design in secp-zpk (Gregory Sanders)
1cb252e01 Descriptor support in PAK infrastructure and tests (Gregory Sanders)
636673447 Properly encode parent witness addresses (Gregory Sanders)
7e63ce39e Extend validateaddress to check parent address validity. (Gregory Sanders)
85bcda52f pak mempool removal: don't modify the vector you are taking range over (Gregory Sanders)
8de42370d fixup mempool clearing of peg-outs on block commitment (Gregory Sanders)
542b826c9 ScriptHasvalidPAKProof: Allow any standard single-key output script type (Gregory Sanders)
71acfb359 Add IsPayToWitnessPubkeyHash convenience function (Gregory Sanders)
1241343bd testproposedblock: Reject blocks with non-matching pak commitments (Gregory Sanders)
47ea638b4 miner adds commitment when pak enforcement is set only (Gregory Sanders)
3fc3ac340 disallow pak enforcement arg when nonstandard tx are possible (Gregory Sanders)
dfe5331db Miner adds PAK commitments when config 'disagress' with block commits (Gregory Sanders)
bcd8db972 functional test for pak feature (Gregory Sanders)
5b6d767b6 Load PAK arguments from config and disk on startup (Gregory Sanders)
d391782cd Add getwalletpakinfo RPC call (Gregory Sanders)
f06e6f648 Wallet offline_counter starts at -1 (Gregory Sanders)
0e52456f3 Return status of pak enforcement on the blockchain in (Gregory Sanders)
050bb4905 Add getpakinfo RPC call, without wallet state (Gregory Sanders)
3cfe2d49e Add sendtomainchain RPC call which is used when -pak_enforce is enabled (Gregory Sanders)
567de67af Break out sendtomainchain to call functions based on -enforce_pak (Gregory Sanders)
070be0f5c add initpegout RPC for peg-out wallet initialization (Gregory Sanders)
47422e71d Write and load peg-out wallet functions on wallet load (Gregory Sanders)
4e631bd77 Add derivation helpers for peg-out wallet infrastructure (Gregory Sanders)
1559cc9c3 C(Pub)Key::Derive: Return optional tweak vector for peg-out wallets (Gregory Sanders)
f1dbd1cf3 -multi_data_permitted: Allow >1 op_return output by policy (Gregory Sanders)
9f5cc03f9 Read PAK list from connected blocks, save list, and boot transactions not conforming (Gregory Sanders)
86fbc2418 GetPAKKeysFromCommitment utility function (Gregory Sanders)
bf66d77a8 Add Read/Write functions to txdb for PAK lists (Gregory Sanders)
2b4899dd3 PAK enforcement via standardness, drop multi-op_return restriction (Gregory Sanders)
6679823fc Create global PAK lists for config and blockchain state (Gregory Sanders)
8c7746c4d Add CScript::IsPayToPubkeyHash convienience function (Gregory Sanders)
43424cbf7 Add PAK proof validation function (Gregory Sanders)
378e59461 Define PAKList structure and operations (Gregory Sanders)
40571ab6d Turn on secp-zkp experimental modules for PAK (Gregory Sanders)
2019-01-24 17:25:36 +00:00
Gregory Sanders
71acfb359b Add IsPayToWitnessPubkeyHash convenience function 2019-01-24 11:07:11 -05:00
Gregory Sanders
8c7746c4de Add CScript::IsPayToPubkeyHash convienience function 2019-01-24 11:06:55 -05:00
Gregory Sanders
c5a93c008f UPSTREAM MERGE BROKEN: Merge commit '8aa9badf5e' into e17 2019-01-23 16:48:22 -05:00
Steven Roose
a09e63fdad
Make OP_DETERMINISTICRANDOM endian-safe
Fixing a TODO from elements-0.14.1.

Signed-off-by: Steven Roose <steven@stevenroose.org>
2019-01-14 11:08:45 +00:00
Steven Roose
1967112d98 Fix typo in comment 2019-01-14 11:07:02 +00:00
Steven Roose
547d3a0c10 Add OP_SUBSTR_LAZY 2019-01-11 18:18:24 +00:00
Steven Roose
13e1103abe Re-enable several disabled opcodes
Re-enabled opcodes are:

- OP_CAT
- OP_SUBSTR
- OP_LEFT
- OP_RIGHT
- OP_INVERT
- OP_AND
- OP_OR
- OP_XOR
- OP_LSHIFT
- OP_RSHIFT
2019-01-11 17:42:01 +00:00
Steven Roose
c27ea98605 Add OP_CHECKSIGFROMSTACK[VERIFY] 2019-01-10 12:12:16 +00:00
Steven Roose
358a1bb494 Add OP_DETERMINISTICRANDOM 2019-01-10 12:11:11 +00:00
Steven Roose
7bb9380260 Recognize pegout scripts 2019-01-02 18:46:02 +01:00
Steven Roose
ac1eadd0de Add support for NullData addresses (OP_RETURN) 2019-01-02 16:12:47 +01:00
Steven Roose
d39d440fcf Add mainchain rpc client 2019-01-02 16:12:47 +01:00
Steven Roose
238a72bead Add arguments for parent chain characteristics 2019-01-02 16:12:42 +01:00
Gregory Sanders
7bc578a398 Add SimpleSignatureChecker, SCRIPT_NO_SIGHASH_BYTE validation flag 2018-12-18 17:26:51 -05:00
lucash-dev
faf29dd019 Minimal changes to comply with explicit CMutableTransaction -> CTranaction conversion.
This commit makes the minimal changes necessary to fix compilation once CTransaction(const CMutableTransaction &tx) is made explicit. In each case an explicit call `CTransaction(...)` was added. Shouldn't affect behaviour or performance.
2018-12-17 21:02:42 -08:00
Pieter Wuille
82df4c64ff Add descriptor expansion cache 2018-11-28 15:24:49 -08:00
Pieter Wuille
1eda33aabc [refactor] Combine the ToString and ToPrivateString implementations 2018-11-28 15:24:49 -08:00
Pieter Wuille
24d3a7b3a9 [refactor] Use DescriptorImpl internally, permitting access to new methods 2018-11-28 15:24:49 -08:00
Pieter Wuille
6be0fb4b3f [refactor] Add a base DescriptorImpl with most common logic 2018-11-28 15:16:17 -08:00
Pieter Wuille
fdf146f329
Merge #14477: Add ability to convert solvability info to descriptor
109699dd33 Add release notes (Pieter Wuille)
b65326b562 Add matching descriptors to scantxoutset output + tests (Pieter Wuille)
16203d5df7 Add descriptors to listunspent and getaddressinfo + tests (Pieter Wuille)
9b2a25b13f Add tests for InferDescriptor and Descriptor::IsSolvable (Pieter Wuille)
225bf3e3b0 Add Descriptor::IsSolvable() to distinguish addr/raw from others (Pieter Wuille)
4d78bd93b5 Add support for inferring descriptors from scripts (Pieter Wuille)

Pull request description:

  This PR adds functionality to convert a script to a descriptor, given a `SigningProvider` with the relevant information about public keys and redeemscripts/witnessscripts.

  The feature is exposed in `listunspent`, `getaddressinfo`, and `scantxoutset` whenever these calls are applied to solvable outputs/addresses.

  This is not very useful on its own, though when we add RPCs to import descriptors, or sign PSBTs using descriptors, these strings become a compact and standalone way of conveying everything necessary to sign an output (excluding private keys).

  Unit tests and rudimentary RPC tests are included (more relevant tests can be added once RPCs support descriptors).

  Fixes #14503.

Tree-SHA512: cb36b84a3e0200375b7e06a98c7e750cfaf95cf5de132cad59f7ec3cbd201f739427de0dc108f515be7aca203652089fbf5f24ed283d4553bddf23a3224ab31f
2018-11-27 12:22:41 -08:00
Wladimir J. van der Laan
0595164dba
Merge #14678: [wallet] remove redundant KeyOriginInfo access, already done in CreateSig
b81a186056 GetPubKey: make sigdata const (Gregory Sanders)
f7beb95a1f remove redundant KeyOriginInfo access, already done in CreateSig (Gregory Sanders)

Pull request description:

  This redundancy is confusing as it looks like pubkeyhashes are special in some way based on where it's called.

Tree-SHA512: a980b7c774c6d69322945227a2b156489fb1991ebf57fe6f26096d5f8047f246a133debc241b05af67810f604b040079add3ab3d30d9e2928095905a2afe17eb
2018-11-23 10:13:03 +01:00