Class Transaction

Represents a Bitcoin transaction.

Hierarchy

  • Transaction

Constructors

Properties

ins: TxInput[] = []
locktime: number = 0
outs: TxOutput[] = []
version: number = 1
ADVANCED_TRANSACTION_FLAG: 1 = 0x01
ADVANCED_TRANSACTION_MARKER: 0 = 0x00
DEFAULT_SEQUENCE: 4294967295 = 0xffffffff
SIGHASH_ALL: 1 = 0x01
SIGHASH_ANYONECANPAY: 128 = 0x80
SIGHASH_DEFAULT: 0 = 0x00
SIGHASH_INPUT_MASK: 128 = 0x80
SIGHASH_NONE: 2 = 0x02
SIGHASH_OUTPUT_MASK: 3 = 0x03
SIGHASH_SINGLE: 3 = 0x03

Methods

  • Parameters

    • hash: Buffer
    • index: number
    • Optional sequence: number
    • Optional scriptSig: Buffer

    Returns number

  • Parameters

    • scriptPubKey: Buffer
    • value: number

    Returns number

  • Parameters

    • _ALLOW_WITNESS: boolean = true

    Returns number

  • Parameters

    • Optional forWitness: boolean

    Returns Buffer

  • Hash transaction for signing a specific input.

    Bitcoin uses a different hash for each signed transaction input. This method copies the transaction, makes the necessary changes based on the hashType, and then hashes the result. This hash can then be used to sign the provided transaction input.

    Parameters

    • inIndex: number
    • prevOutScript: Buffer
    • hashType: number

    Returns Buffer

  • Parameters

    • inIndex: number
    • prevOutScript: Buffer
    • value: number
    • hashType: number

    Returns Buffer

  • Parameters

    • inIndex: number
    • prevOutScripts: Buffer[]
    • values: number[]
    • hashType: number
    • Optional leafHash: Buffer
    • Optional annex: Buffer

    Returns Buffer

  • Parameters

    • index: number
    • scriptSig: Buffer

    Returns void

  • Parameters

    • index: number
    • witness: Buffer[]

    Returns void

  • Parameters

    • Optional buffer: Buffer
    • Optional initialOffset: number

    Returns Buffer

  • Parameters

    • buffer: Buffer

    Returns boolean