<commit_before><pre>
  BIP: PSET
  Layer: Applications
  Title: Partially Signed Elements Transaction Format
  Author: <NAME> <<EMAIL>>
  Comments-Summary: No comments yet.
  Status: Proposed
  Type: Standards Track
  Created: 2020-07-09
  License: BSD-2-Clause
</pre>

==Introduction==

===Abstract===

This document describes proprietary extensions to the BIP 174 Partially Signed Bitcoin Transaction format.
These extensions are for use in Elements Sidechains to hold the information necessary for
Confidential Transactions, Confidential Assets, and Peg-in transactions.

===Copyright===

This BIP is licensed under the 2-clause BSD license.

==Specification==

The Partially Signed Elements Transaction (PSET) format extends the BIP 370 PSBT format.
The changes are new proprietary type fields, a new magic sequence, new roles, and changes
to make some PSBT fields conditionally mandatory.

The fields added for PSET are only allowed when the PSBT version is 2.

For elements, the identifier prefix string is <tt>pset</tt>.
Note that previous implementations of PSET used a different prefix string and had different fields.
The use of a new identifier prefix is to avoid conflicts with the previous implementations.

The following PSBT fields are made conditionally mandatory:

# <tt>PSBT_OUT_AMOUNT</tt> is not mandatory once a transaction output is blinded
# <tt>PSBT_OUT_SCRIPT</tt> is not mandatory for L-BTC fee outputs

The currently defined elements global proprietary types are as follows:

{|
! Name
! <tt><keytype></tt>
! <tt><keydata></tt>
! <tt><keydata></tt> Description
! <tt><valuedata></tt>
! <tt><valuedata></tt> Description
! Versions Requiring Inclusion
! Versions Requiring Exclusion
! Versions Allowing Inclusion
|-
| Scalar Offset
| <tt>PSBT_ELEMENTS_GLOBAL_SCALAR = 0x00</tt>
| <tt><32 byte scalar></tt>
| A 32 byte Scalar Offset computed by a blinder.
| None
| No value. The value must have a length of zero.
|
| 0
| 2
|-
| Elements Transaction Modifiable Flag
| <tt>PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE = 0x01</tt>
| None
| No key data
| <tt><8-bit uint></tt>
| An 8 bit unsigned integer as a bitfield for various elements specific transaction modification flags. Bit 0 is reserved and should not be used. If it is set when reading a PSET, it should be ignored. This field defaults to 0 and should not be output if its value is 0.
|
| 0
| 2
|}

The currently defined elements per-input proprietary types are as follows:

{|
! Name
! <tt><keytype></tt>
! <tt><keydata></tt>
! <tt><keydata></tt> Description
! <tt><valuedata></tt>
! <tt><valuedata></tt> Description
! Versions Requiring Inclusion
! Versions Requiring Exclusion
! Versions Allowing Inclusion
|-
| Issuance Value
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE = 0x00</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The explicit little endian 64-bit integer for the value of this issuance.
|
| 0
| 2
|-
| Issuance Value Commitment
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT = 0x01</tt>
| None
| No key data
| <tt><33 byte commitment></tt>
| The 33 byte Value Commitment. If provided, either <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE</tt> must be removed, or <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_VALUE_PROOF</tt> must be provided too.
|
| 0
| 2
|-
| Issuance Value Rangeproof
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_RANGEPROOF = 0x02</tt>
| None
| No key data
| <tt><rangeproof></tt>
| The rangeproof
|
| 0
| 2
|-
| Issuance Inflation Keys Rangeproof
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_KEYS_RANGEPROOF = 0x03</tt>
| None
| No key data
| <tt><rangeproof></tt>
| The rangeproof
|
| 0
| 2
|-
| Peg-in Transaction
| <tt>PSBT_ELEMENTS_IN_PEG_IN_TX = 0x04</tt>
| None
| No key data
| <tt><tx></tt>
| The Peg-in Transaction serialized without witnesses.
|
| 0
| 2
|-
| Peg-in Transaction Output Proof
| <tt>PSBT_ELEMENTS_IN_PEG_IN_TXOUT_PROOF = 0x05</tt>
| None
| No key data
| <tt><txoutproof></tt>
| The transaction output proof for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Genesis Hash
| <tt>PSBT_ELEMENTS_IN_PEG_IN_GENESIS = 0x06</tt>
| None
| No key data
| <tt><hash></tt>
| The 32 byte genesis hash for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Claim Script
| <tt>PSBT_ELEMENTS_IN_PEG_IN_CLAIM_SCRIPT = 0x07</tt>
| None
| No key data
| <tt><script></tt>
| The claim script for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Value
| <tt>PSBT_ELEMENTS_IN_PEG_IN_VALUE = 0x08</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The little endian 64-bit value of the peg-in for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Witness
| <tt>PSBT_ELEMENTS_IN_PEG_IN_WITNESS = 0x09</tt>
| None
| No key data
| <tt><script></tt>
| The Peg-in witness for the Peg-in Transaction.
|
| 0
| 2
|-
| Issuance Inflation Keys Amount
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS = 0x0a</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The value for the inflation keys output to set in this issuance.
|
| 0
| 2
|-
| Issuance Inflation Keys Amount Commitment
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS_COMMITMENT = 0x0b</tt>
| None
| No key data
| <tt><33 byte commitment></tt>
| The 33 byte commitment to the inflation keys output value in this issuance. If provided, either <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt> must be removed or <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF</tt> must be provided too.
|
| 0
| 2
|-
| Issuance Blinding Nonce
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLINDING_NONCE = 0x0c</tt>
| None
| No key data<commit_msg>PSET: docs: Fix the data type of PSBT_ELEMENTS_IN_PEG_IN_WITNESS<commit_after><pre>
  BIP: PSET
  Layer: Applications
  Title: Partially Signed Elements Transaction Format
  Author: <NAME> <<EMAIL>>
  Comments-Summary: No comments yet.
  Status: Proposed
  Type: Standards Track
  Created: 2020-07-09
  License: BSD-2-Clause
</pre>

==Introduction==

===Abstract===

This document describes proprietary extensions to the BIP 174 Partially Signed Bitcoin Transaction format.
These extensions are for use in Elements Sidechains to hold the information necessary for
Confidential Transactions, Confidential Assets, and Peg-in transactions.

===Copyright===

This BIP is licensed under the 2-clause BSD license.

==Specification==

The Partially Signed Elements Transaction (PSET) format extends the BIP 370 PSBT format.
The changes are new proprietary type fields, a new magic sequence, new roles, and changes
to make some PSBT fields conditionally mandatory.

The fields added for PSET are only allowed when the PSBT version is 2.

For elements, the identifier prefix string is <tt>pset</tt>.
Note that previous implementations of PSET used a different prefix string and had different fields.
The use of a new identifier prefix is to avoid conflicts with the previous implementations.

The following PSBT fields are made conditionally mandatory:

# <tt>PSBT_OUT_AMOUNT</tt> is not mandatory once a transaction output is blinded
# <tt>PSBT_OUT_SCRIPT</tt> is not mandatory for L-BTC fee outputs

The currently defined elements global proprietary types are as follows:

{|
! Name
! <tt><keytype></tt>
! <tt><keydata></tt>
! <tt><keydata></tt> Description
! <tt><valuedata></tt>
! <tt><valuedata></tt> Description
! Versions Requiring Inclusion
! Versions Requiring Exclusion
! Versions Allowing Inclusion
|-
| Scalar Offset
| <tt>PSBT_ELEMENTS_GLOBAL_SCALAR = 0x00</tt>
| <tt><32 byte scalar></tt>
| A 32 byte Scalar Offset computed by a blinder.
| None
| No value. The value must have a length of zero.
|
| 0
| 2
|-
| Elements Transaction Modifiable Flag
| <tt>PSBT_ELEMENTS_GLOBAL_TX_MODIFIABLE = 0x01</tt>
| None
| No key data
| <tt><8-bit uint></tt>
| An 8 bit unsigned integer as a bitfield for various elements specific transaction modification flags. Bit 0 is reserved and should not be used. If it is set when reading a PSET, it should be ignored. This field defaults to 0 and should not be output if its value is 0.
|
| 0
| 2
|}

The currently defined elements per-input proprietary types are as follows:

{|
! Name
! <tt><keytype></tt>
! <tt><keydata></tt>
! <tt><keydata></tt> Description
! <tt><valuedata></tt>
! <tt><valuedata></tt> Description
! Versions Requiring Inclusion
! Versions Requiring Exclusion
! Versions Allowing Inclusion
|-
| Issuance Value
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE = 0x00</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The explicit little endian 64-bit integer for the value of this issuance.
|
| 0
| 2
|-
| Issuance Value Commitment
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_COMMITMENT = 0x01</tt>
| None
| No key data
| <tt><33 byte commitment></tt>
| The 33 byte Value Commitment. If provided, either <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE</tt> must be removed, or <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_VALUE_PROOF</tt> must be provided too.
|
| 0
| 2
|-
| Issuance Value Rangeproof
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_VALUE_RANGEPROOF = 0x02</tt>
| None
| No key data
| <tt><rangeproof></tt>
| The rangeproof
|
| 0
| 2
|-
| Issuance Inflation Keys Rangeproof
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_KEYS_RANGEPROOF = 0x03</tt>
| None
| No key data
| <tt><rangeproof></tt>
| The rangeproof
|
| 0
| 2
|-
| Peg-in Transaction
| <tt>PSBT_ELEMENTS_IN_PEG_IN_TX = 0x04</tt>
| None
| No key data
| <tt><tx></tt>
| The Peg-in Transaction serialized without witnesses.
|
| 0
| 2
|-
| Peg-in Transaction Output Proof
| <tt>PSBT_ELEMENTS_IN_PEG_IN_TXOUT_PROOF = 0x05</tt>
| None
| No key data
| <tt><txoutproof></tt>
| The transaction output proof for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Genesis Hash
| <tt>PSBT_ELEMENTS_IN_PEG_IN_GENESIS = 0x06</tt>
| None
| No key data
| <tt><hash></tt>
| The 32 byte genesis hash for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Claim Script
| <tt>PSBT_ELEMENTS_IN_PEG_IN_CLAIM_SCRIPT = 0x07</tt>
| None
| No key data
| <tt><script></tt>
| The claim script for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Value
| <tt>PSBT_ELEMENTS_IN_PEG_IN_VALUE = 0x08</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The little endian 64-bit value of the peg-in for the Peg-in Transaction.
|
| 0
| 2
|-
| Peg-in Witness
| <tt>PSBT_ELEMENTS_IN_PEG_IN_WITNESS = 0x09</tt>
| None
| No key data
| <tt><scriptWitness></tt>
| The Peg-in witness for the Peg-in Transaction.
|
| 0
| 2
|-
| Issuance Inflation Keys Amount
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS = 0x0a</tt>
| None
| No key data
| <tt><64-bit int></tt>
| The value for the inflation keys output to set in this issuance.
|
| 0
| 2
|-
| Issuance Inflation Keys Amount Commitment
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS_COMMITMENT = 0x0b</tt>
| None
| No key data
| <tt><33 byte commitment></tt>
| The 33 byte commitment to the inflation keys output value in this issuance. If provided, either <tt>PSBT_ELEMENTS_IN_ISSUANCE_INFLATION_KEYS</tt> must be removed or <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLIND_INFLATION_KEYS_PROOF</tt> must be provided too.
|
| 0
| 2
|-
| Issuance Blinding Nonce
| <tt>PSBT_ELEMENTS_IN_ISSUANCE_BLINDING_NONCE = 0x0c</tt>
| None
| No key data
{'fraction_non_alphanumeric': 0.10917750503755266, 'fraction_numerical': 0.021249313061000183, 'mean_word_length': 4.698851774530271, 'pattern_counts': {'":': 0, '<': 245, '<?xml version=': 0, '>': 245, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4966432', 'n_tokens_mistral': 4125, 'n_tokens_neox': 3776, 'n_words': 1244}