• Public
  • Public/Protected
  • All

Interface Output<Bytecode, Amount>

Data type representing a Transaction Output.

Type parameters

  • Bytecode

    the type of lockingBytecode - this can be configured to allow for defining compilation directives

  • Amount

    the type of satoshis


  • Output



Readonly lockingBytecode

lockingBytecode: Bytecode

The bytecode used to encumber this transaction output. To spend the output, unlocking bytecode must be included in a transaction input which – when evaluated before the locking bytecode – completes in a valid state.

A.K.A. scriptPubKey or "locking script"

Readonly satoshis

satoshis: Amount

The 8-byte Uint64LE-encoded value of the output in satoshis, the smallest unit of bitcoin.

There are 100 satoshis in a bit, and 100,000,000 satoshis in a bitcoin.

This value could be defined using a number, as Number.MAX_SAFE_INTEGER (9007199254740991) is about 4 times larger than the maximum number of satoshis which should ever exist. I.e. even if all satoshis were consolidated into a single output, the transaction spending this output could still be defined with a numeric satoshis value.

However, because the encoded output format for version 1 and 2 transactions (used in both transaction encoding and signing serialization) uses a 64-bit unsigned, little-endian integer to serialize satoshis, this property is encoded in the same format, allowing it to cover the full possible range.

This is useful for encoding values using schemes for fractional satoshis (for which no finalized specification yet exists) or for encoding intentionally excessive values. For example, invalidSatoshis (0xffffffffffffffff - the maximum uint64 value) is a clearly impossible satoshis value for version 1 and 2 transactions. As such, this value can safely by used by transaction signing and verification implementations to ensure that an otherwise properly-signed transaction can never be included n the blockchain, e.g. for transaction size estimation or off-chain Bitauth signatures.

To convert this value to and from a BigInt use bigIntToBinUint64LE and binToBigIntUint64LE, respectively.

Generated using TypeDoc