• Public
  • Public/Protected
  • All

Interface AuthenticationProgramStateCommon<Opcodes, Errors, StackType, CommonError>

Type parameters

  • Opcodes

  • Errors

  • StackType

  • CommonError





alternateStack: StackType[]

The "alternate stack" is separate stack on which OP_TOALTSTACK and OP_FROMALTSTACK operate in bitcoin virtual machines.

Optional Readonly correspondingOutput

correspondingOutput: Uint8Array

Optional error

error: CommonError | Errors

If present, the error returned by the most recent virtual machine operation.


executionStack: boolean[]

An array of boolean values representing the current execution status of the program. This allows the state to track nested conditional branches.

The OP_IF and OP_NOTIF operations push a new boolean onto the executionStack, OP_ELSE flips the top boolean, and OP_ENDIF removes the top boolean from the executionStack.

Other instructions are only evaluated if executionStack contains no false items.

A.K.A. vfExec in the C++ implementation.

Readonly instructions

instructions: keyof AuthenticationInstruction<Opcodes>[]

The full list of instructions to be evaluated by the virtual machine.


ip: number

Instruction Pointer – the array index of instructions which will be read to identify the next instruction. Once ip exceeds the last index of instructions (ip === instructions.length), evaluation is complete.


lastCodeSeparator: number

The lastCodeSeparator indicates the index of the most recently executed OP_CODESEPARATOR instruction. In each of the signing serialization algorithms, the instructions are sliced at lastCodeSeparator, and the subarray is re-serialized. The resulting bytecode is called the coveredBytecode (A.K.A. scriptCode), and is part of the data hashed to create the signing serialization digest.

By default, this is -1, which indicates that the whole instructions array is included in the signing serialization.

Readonly locktime

locktime: number

A time or block height at which the transaction is considered valid (and can be added to the block chain). This allows signers to create time-locked transactions which may only become valid in the future.


operationCount: number

Readonly outpointIndex

outpointIndex: number

The index (within the previous transaction) of the outpoint being spent by this input.

Readonly outpointTransactionHash

outpointTransactionHash: Uint8Array

The hash/ID of the transaction from which the outpoint being spent by this input originated.

Readonly outputValue

outputValue: Uint8Array

The 8-byte Uint64LE-encoded value of the outpoint in satoshis (see bigIntToBinUint64LE).

Readonly sequenceNumber

sequenceNumber: number

The sequenceNumber associated with the input being validated. See Input.sequenceNumber for details.


signatureOperationsCount: number


signedMessages: Uint8Array[]

An array of the Uint8Array values used in signature verification over the course of this program. Each raw signing serialization and data signature message should be pushed to this array in the order it was computed.

This property is not used within any AuthenticationVirtualMachine, but it is provided in the program state to assist with analysis. Because these messages must always be computed and hashed during evaluation, recording them in the state does not meaningfully affect performance.


stack: StackType[]

The stack is the primary workspace of the virtual machine. Most virtual machine operations create, read, update, or delete bytecode values held on the stack.

Readonly transactionOutpoints

transactionOutpoints: Uint8Array

A.K.A. the serialization for hashPrevouts

The signing serialization of all input outpoints. (See BIP143 or Bitcoin Cash's Replay Protected Sighash spec for details.)

Readonly transactionOutputs

transactionOutputs: Uint8Array

Readonly transactionSequenceNumbers

transactionSequenceNumbers: Uint8Array

Readonly version

version: number

Generated using TypeDoc