-
Notifications
You must be signed in to change notification settings - Fork 387
Redesign PSET #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Redesign PSET #900
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
fdf71de
Remove PSET and disable PSBT/PSET things for now
achow101 e882a3a
Types are compact size uints
achow101 50c281f
Implement PSBT versions
achow101 ad2b2d7
Add GetVersion helper to PSBT
achow101 25c13ad
Output psbt version in decodepsbt
achow101 575fec0
Implement PSBT proprietary type
achow101 5bb930e
Output proprietary type info in decodepsbt
achow101 31a7e0a
Test for proprietary field
achow101 fad29ba
moveonly: Move (Un)Serialize(To/From)Vector, (De)SerializeHDKeypaths …
achow101 cb9c553
Store version bytes and be able to serialize them in CExtPubKey
achow101 4eabba9
Separate individual HD Keypath serialization into separate functions
achow101 5b5c5ef
Implement operator< for KeyOriginInfo and CExtPubKey
achow101 2c54175
Implement serializations for PSBT_GLOBAL_XPUB
achow101 7fd50b2
Add global_xpubs to decodepsbt
achow101 bc2651d
Add global xpub test vectors from BIP
achow101 20e8dff
Merge global xpubs in joinpsbts and combinepsbts
achow101 ec03f83
Define psbtv2 field numbers
achow101 dd792ce
Implement PSBTv2 fields de/ser
achow101 8c62443
Change PSBT unknown fields test to use higher numbers
achow101 2042765
Have PSBTInput and PSBTOutput know the PSBT's version
achow101 457b6bd
Enforce PSBT version constraints
achow101 c32950e
Add PSBT::CacheUnsignedTxPieces
achow101 32234df
Call CacheUnsignedTxPieces in PSBT constructor
achow101 4b805fd
Convert PSBTv0 unsigned tx to PSBTv2 fields
achow101 3c647b7
Replace PSBT::GetInputUTXO with PSBTInput::GetUTXO
achow101 10bf247
Add PSBT::ComputeLockTime()
achow101 32bdf2d
Add PSBT::GetUnsignedTx
achow101 bd1a57b
Add PSBT::GetUniqueID
achow101 90cd7ec
Change PSBT::AddInput to take just PSBTInput
achow101 cd5515a
Change PSBT::AddOutput to take just PSBTOutput
achow101 4ff2593
Implement PSBTv2 field merging
achow101 d8dba33
Add PSBTInput::GetOutPoint
achow101 23f6442
Update SignPSBTInput for PSBTv2
achow101 f269d11
Update FinalizeAndExtract for v2
achow101 500554a
Update AnalyzePSBT for PSBTv2
achow101 c9c23ca
Update PSBT Operations Dialog for v2
achow101 9c83300
Update RPCs for PSBTv2
achow101 16395c1
Update wallet for PSBTv2
achow101 139ac36
Implement PSBTv2 AddInput and AddOutput
achow101 bedc1e0
Implement PSBTv2 in decodepsbt
achow101 a34474e
Allow specifying PSBT version in constructor
achow101 e467ec6
Update PSBT::UpdatePSBTOutput to use GetUnsignedTx
achow101 2c1fe58
Allow and create PSBTv2 in RPCs
achow101 ebc49e3
Allow createpsbt and walletcreatefundedpsbt to take psbt version
achow101 f4bca18
Restrict joinpsbts to PSBTv0 only
achow101 0ca0b7e
Update rpc_psbt.py to test PSBTv0 explicitly in some places
achow101 e860cd0
Add a PSBT constructor for providing the version
achow101 ecaf5ea
Use GetUnsignedTx when serializing in PSBTv0
achow101 b372430
Implement PSET fields and their de/ser
achow101 e374397
Implement and enable decodepsbt for PSET
achow101 f84a927
Add DecomposePeginWitness
achow101 ee28be3
Extract elements fields for tx into psbt
achow101 33c694f
Helper functions to determine whether a PSBTOutput is blinded
achow101 2220d84
Return peg-in UTXO with GetUTXO
achow101 6890461
Implement blinded combiner stuff
achow101 79c4a99
pset: add issuance things
achow101 bdfcb43
Add calculateasset RPC
achow101 1dbc3b2
Implement updatepsbtpegin RPC
achow101 e7dd046
Implement BlindPSBT
achow101 3f6c8bf
Add walletblindpsbt rpc
achow101 9a450ec
Set blinder_index to self in walletcreatefundedpsbt
achow101 bad1876
Re-enable and fix PSBT signing
achow101 e6cc0fd
Have walletprocesspsbt blind before signing
achow101 ea2c3df
Remove output_assets and have asset field in outputs
achow101 5391095
Output PSBTOutputs with aux info from ConstructTransaction
achow101 f686e0f
Remove walletfillpsbtdata RPC
achow101 124efa2
Return better errors for BlindingStatus
achow101 a8a6f4c
Add IsBlinded and IsFullyBlinded helpers for PSBT
achow101 3db2622
Only sign blinded PSBTs in walletprocesspsbt
achow101 eeb6cf7
Mark PSET as being implemented
achow101 e9bfff2
Allow empty scriptPubKeys
achow101 25df8aa
Fixes to FillPSBT
achow101 2c0cee5
Update GetUnsignedTx for PSET
achow101 c0cb623
Allow value commitments instead of explicit value
achow101 bd97836
Update FinalizeAndExtract for PSEt
achow101 0e2f1ff
Make m_peg_in_witness during SignPSBTInput
achow101 d8fa5c1
Use createtx array outputs
achow101 b1ebc81
Remove walletsignpsbt, blindpsbt, walletblindpsbt, and
achow101 46ccf61
Only allow psbt_version 2
achow101 afd7950
Update rpc_psbt.py for PSET
achow101 1889554
Remove unnecessary psbt blinding test
achow101 80ff739
Default to adding bip32 derivs
achow101 b65a00f
Add PSBTOutput::GetTxOut()
achow101 64b30bf
Enable analyzepsbt
achow101 7533503
Initialize optionals with nullopt
achow101 9fe6401
Allow specifying SIGHASH_RANGEPROOF
achow101 4a44ff2
Check elements blinding field constraints during deser
achow101 4940cee
Use a constant for maximum surjection targets
achow101 5425da4
Enable converttopsbt for PSET
achow101 864f625
Fix display of outputs in PSBT ops dialog
achow101 f8553c5
Disable joinpsbts
achow101 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Note that this format is not yet implemented by Elements. | ||
|
||
<pre> | ||
BIP: PSET | ||
Layer: Applications | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2020 The Elements Core developers | ||
// // Distributed under the MIT software license, see the accompanying | ||
// // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
|
||
#ifndef BITCOIN_BLINDPSBT_H | ||
#define BITCOIN_BLINDPSBT_H | ||
|
||
#include <blind.h> | ||
#include <key.h> | ||
#include <pubkey.h> | ||
#include <primitives/transaction.h> | ||
#include <primitives/confidential.h> | ||
|
||
#include <secp256k1.h> | ||
#include <secp256k1_rangeproof.h> | ||
#include <secp256k1_surjectionproof.h> | ||
|
||
struct PartiallySignedTransaction; | ||
|
||
enum class BlindingStatus | ||
{ | ||
OK, //!< No error | ||
NEEDS_UTXOS, | ||
INVALID_ASSET, | ||
INVALID_ASSET_COMMITMENT, | ||
SCALAR_UNABLE, | ||
INVALID_BLINDER, | ||
ASP_UNABLE, | ||
}; | ||
|
||
std::string GetBlindingStatusError(const BlindingStatus& status); | ||
|
||
bool CreateAssetSurjectionProof(std::vector<unsigned char>& output_proof, const std::vector<secp256k1_fixed_asset_tag>& fixed_input_tags, const std::vector<secp256k1_generator>& ephemeral_input_tags, const std::vector<uint256>& input_asset_blinders, const uint256& output_asset_blinder, const secp256k1_generator& output_asset_tag, const CAsset& asset); | ||
uint256 GenerateRangeproofECDHKey(CPubKey& ephemeral_pubkey, const CPubKey blinding_pubkey); | ||
bool CreateValueRangeProof(std::vector<unsigned char>& rangeproof, const uint256& value_blinder, const uint256& nonce, const CAmount amount, const CScript& scriptPubKey, const secp256k1_pedersen_commitment& value_commit, const secp256k1_generator& gen, const CAsset& asset, const uint256& asset_blinder); | ||
void CreateAssetCommitment(CConfidentialAsset& conf_asset, secp256k1_generator& asset_gen, const CAsset& asset, const uint256& asset_blinder); | ||
void CreateValueCommitment(CConfidentialValue& conf_value, secp256k1_pedersen_commitment& value_commit, const uint256& value_blinder, const secp256k1_generator& asset_gen, const CAmount amount); | ||
BlindingStatus BlindPSBT(PartiallySignedTransaction& psbt, std::map<uint32_t, std::tuple<CAmount, CAsset, uint256, uint256>> our_input_data, std::map<uint32_t, std::pair<CKey, CKey>> our_issuances_to_blind); | ||
|
||
#endif //BITCOIN_BLINDPSBT_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.