The index of the output in the transaction from which this input is spent.
The hash of the raw transaction from which this input is spent in big-endian byte order. This is the byte order typically seen in block explorers and user interfaces (as opposed to little-endian byte order, which is used in standard P2P network messages).
A.K.A. Transaction ID
The positive, 32-bit unsigned integer used as the "sequence number" for this input.
A sequence number is a complex bitfield which can encode several properties about an input:
OP_CHECKSEQUENCEVERIFY
, and the minimum number of blocks or length of
time which has passed since this input's source transaction was mined (up
to approximately 1 year).OP_CHECKLOCKTIMEVERIFY
Sequence Age Support
Sequence number age is enforced by mining consensus – a transaction is invalid until it has "aged" such that all outputs referenced by its age-enabled inputs are at least as old as claimed by their respective sequence numbers.
This allows sequence numbers to function as a "relative locktime" for each
input: a lockingBytecode
can use the OP_CHECKSEQUENCEVERIFY
operation
to verify that the funds being spent have been "locked" for a minimum
required amount of time (or block count). This can be used in protocols
which require a reliable "proof-of-publication", like escrow, time-delayed
withdrawals, and various payment channel protocols.
Sequence age support is enabled unless the "disable bit" – the most
significant bit – is set (i.e. the sequence number is less than
(1 << 31) >>> 0
/0b10000000000000000000000000000000
/2147483648
).
If sequence age is enabled, the "type bit" – the most significant bit in
the second-most significant byte
(1 << 22
/0b1000000000000000000000
/2097152
) – indicates the unit type
of the specified age:
512
seconds (using Median Time-Past)The least significant 16 bits specify the age (i.e.
age = sequenceNumber & 0x0000ffff
). This makes the maximum age either
65535
blocks (about 1.25 years) or 33553920
seconds (about 1.06 years).
Locktime Support
Locktime support is disabled for an input if the sequence number is exactly
0xffffffff
(4294967295
). Because this value requires the "disable bit"
to be set, disabling locktime support also disables sequence age support.
With locktime support disabled, if either OP_CHECKLOCKTIMEVERIFY
or
OP_CHECKSEQUENCEVERIFY
are encountered during the validation of
unlockingBytecode
, an error is produced, and the transaction is invalid.
The bytecode used to unlock a transaction output. To spend an output, unlocking bytecode must be included in a transaction input which – when evaluated in the authentication virtual machine with the locking bytecode – completes in valid state.
A.K.A. scriptSig
or "unlocking script"
Generated using TypeDoc
Data type representing a Transaction Input.