View Source Bitcoinex.PSBT.Out (bitcoinex v0.3.0)

Output properties of a partially signed bitcoin transaction.

Link to this section Summary

Functions

Adds a field to an output map. Accepted fields

Combines two output maps (BIP-174 Combiner).

Returns an empty output map.

Link to this section Types

@type t() :: %Bitcoinex.PSBT.Out{
  bip32_derivation:
    [
      %{
        public_key: Bitcoinex.Secp256k1.Point.t(),
        origin: Bitcoinex.PSBT.KeyOrigin.t()
      }
    ]
    | nil,
  proprietary: [%{key: binary(), value: binary()}] | nil,
  redeem_script: Bitcoinex.Script.t() | nil,
  unknown: [%{key: binary(), value: binary()}] | nil,
  witness_script: Bitcoinex.Script.t() | nil
}

Link to this section Functions

Link to this function

add_field(output, arg2, script)

View Source
@spec add_field(t(), atom(), any()) :: {:ok, t()} | {:error, atom()}

Adds a field to an output map. Accepted fields:

  • :redeem_script / :witness_script — a Script.t() or its hex/binary
  • :bip32_derivation%{public_key: Point.t(), origin: KeyOrigin.t()} (repeatable)
  • :proprietary / :unknown%{key: binary(), value: binary()} (repeatable); a :proprietary key must carry the 0xFC type byte, and an :unknown key 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
Link to this function

combine(output_a, output_b)

View Source
@spec combine(t(), t()) :: {:ok, t()} | {:error, atom()}

Combines two output maps (BIP-174 Combiner).

@spec new() :: t()

Returns an empty output map.

Link to this function

parse_outputs(psbt, num_outputs)

View Source
@spec parse_outputs(binary(), non_neg_integer()) ::
  {:ok, {[t()], binary()}} | {:error, term()}
Link to this function

serialize_outputs(outputs)

View Source
@spec serialize_outputs([t()] | nil) :: binary()