View Source Bitcoinex.PSBT.In (bitcoinex v0.3.0)
Input properties of a partially signed bitcoin transaction.
Link to this section Summary
Functions
Adds a field to an input map. Accepted fields
Combines two input maps (BIP-174 Combiner).
Attempts to finalize this input (the BIP-174 Input Finalizer role), given the transaction input that references it (used to locate the scriptPubKey and to validate any non-witness UTXO). Returns the finalized input, or the input unchanged if it cannot be finalized (best-effort, matching Bitcoin Core).
Returns true if this input has been finalized (has a final scriptSig and/or scriptWitness).
Returns an empty input map.
Link to this section Types
@type t() :: %Bitcoinex.PSBT.In{ bip32_derivation: [ %{ public_key: Bitcoinex.Secp256k1.Point.t(), origin: Bitcoinex.PSBT.KeyOrigin.t() } ] | nil, final_scriptsig: Bitcoinex.Script.t() | nil, final_scriptwitness: Bitcoinex.Transaction.Witness.t() | nil, hash160: [hash_preimage_record()] | nil, hash256: [hash_preimage_record()] | nil, non_witness_utxo: Bitcoinex.Transaction.t() | nil, partial_sig: [ %{ public_key: Bitcoinex.Secp256k1.Point.t(), signature: binary(), sighash_flag: non_neg_integer() } ] | nil, por_commitment: binary() | nil, proprietary: [key_value_record()] | nil, redeem_script: Bitcoinex.Script.t() | nil, ripemd160: [hash_preimage_record()] | nil, sha256: [hash_preimage_record()] | nil, sighash_type: non_neg_integer() | nil, unknown: [key_value_record()] | nil, witness_script: Bitcoinex.Script.t() | nil, witness_utxo: Bitcoinex.Transaction.Out.t() | nil }
Link to this section Functions
Adds a field to an input map. Accepted fields:
:non_witness_utxo— aTransaction.t():witness_utxo— aTransaction.Out.t():partial_sig—%{public_key: Point.t(), signature: binary(), sighash_flag: flag}(repeatable), wheresignatureis the raw DER-encoded ECDSA signature (stored verbatim, so it round-trips byte-for-byte) andflag(like:sighash_type) must be one of the valid sighash flags0x01/0x02/0x03optionally| 0x80:sighash_type— one of the valid sighash flag integers:redeem_script/:witness_script/:final_scriptsig— aScript.t()or its hex/binary:bip32_derivation—%{public_key: Point.t(), origin: KeyOrigin.t()}(repeatable):final_scriptwitness— aTransaction.Witness.t():por_commitment— a binary:ripemd160/:sha256/:hash160/:hash256—%{hash: binary(), preimage: binary()}(repeatable); the hash must be the digest of the preimage under the named algorithm, else{:error, :invalid_hash_preimage}:proprietary/:unknown—%{key: binary(), value: binary()}(repeatable); a:proprietarykey must carry the 0xFC type byte, and an:unknownkey must be non-empty and must not use a type byte this map already parses into a dedicated field, nor 0xFC ({:error, :invalid_key_format}) — such a record could not survive a decode round-trip
Combines two input maps (BIP-174 Combiner).
@spec finalize(t(), Bitcoinex.Transaction.In.t()) :: t()
Attempts to finalize this input (the BIP-174 Input Finalizer role), given the transaction input that references it (used to locate the scriptPubKey and to validate any non-witness UTXO). Returns the finalized input, or the input unchanged if it cannot be finalized (best-effort, matching Bitcoin Core).
Returns true if this input has been finalized (has a final scriptSig and/or scriptWitness).
@spec new() :: t()
Returns an empty input map.
@spec parse_inputs(binary(), non_neg_integer()) :: {:ok, {[t()], binary()}} | {:error, term()}