Skip to main content

Transaction

reddcoinjs-lib v7.0.1-rdd.1Docs


reddcoinjs-lib v7.0.1-rdd.1 / Transaction

Class: Transaction

Represents a Reddcoin transaction.

Transactions with version > 1 (PoSV) include a 4-byte nTime field after nLockTime. The nTime is included in the transaction hash but excluded from the signing hash.

Constructors

new Transaction()

new Transaction(): Transaction

Returns

Transaction

Properties

ins

ins: TxInput[] = []

Defined in

ts_src/transaction.ts:158


locktime

locktime: number = 0

Defined in

ts_src/transaction.ts:156


nTime

nTime: number = 0

Defined in

ts_src/transaction.ts:157


outs

outs: TxOutput[] = []

Defined in

ts_src/transaction.ts:159


version

version: number = 1

Defined in

ts_src/transaction.ts:155


ADVANCED_TRANSACTION_FLAG

readonly static ADVANCED_TRANSACTION_FLAG: 1 = 0x01

Defined in

ts_src/transaction.ts:80


ADVANCED_TRANSACTION_MARKER

readonly static ADVANCED_TRANSACTION_MARKER: 0 = 0x00

Defined in

ts_src/transaction.ts:79


DEFAULT_SEQUENCE

readonly static DEFAULT_SEQUENCE: 4294967295 = 0xffffffff

Defined in

ts_src/transaction.ts:71


SIGHASH_ALL

readonly static SIGHASH_ALL: 1 = 0x01

Defined in

ts_src/transaction.ts:73


SIGHASH_ANYONECANPAY

readonly static SIGHASH_ANYONECANPAY: 128 = 0x80

Defined in

ts_src/transaction.ts:76


SIGHASH_DEFAULT

readonly static SIGHASH_DEFAULT: 0 = 0x00

Defined in

ts_src/transaction.ts:72


SIGHASH_INPUT_MASK

readonly static SIGHASH_INPUT_MASK: 128 = 0x80

Defined in

ts_src/transaction.ts:78


SIGHASH_NONE

readonly static SIGHASH_NONE: 2 = 0x02

Defined in

ts_src/transaction.ts:74


SIGHASH_OUTPUT_MASK

readonly static SIGHASH_OUTPUT_MASK: 3 = 0x03

Defined in

ts_src/transaction.ts:77


SIGHASH_SINGLE

readonly static SIGHASH_SINGLE: 3 = 0x03

Defined in

ts_src/transaction.ts:75

Methods

addInput()

addInput(hash, index, sequence?, scriptSig?): number

Parameters

hash: Uint8Array

index: number

sequence?: number

scriptSig?: Uint8Array

Returns

number

Defined in

ts_src/transaction.ts:167


addOutput()

addOutput(scriptPubKey, value): number

Parameters

scriptPubKey: Uint8Array

value: bigint

Returns

number

Defined in

ts_src/transaction.ts:199


byteLength()

byteLength(_ALLOW_WITNESS, _EXCLUDE_NTIME): number

Parameters

_ALLOW_WITNESS: boolean = true

_EXCLUDE_NTIME: boolean = false

Returns

number

Defined in

ts_src/transaction.ts:236


clone()

clone(): Transaction

Returns

Transaction

Defined in

ts_src/transaction.ts:261


getHash()

getHash(forWitness?): Uint8Array

Parameters

forWitness?: boolean

Returns

Uint8Array

Defined in

ts_src/transaction.ts:625


getId()

getId(): string

Returns

string

Defined in

ts_src/transaction.ts:631


hasWitnesses()

hasWitnesses(): boolean

Returns

boolean

Defined in

ts_src/transaction.ts:214


hashForSignature()

hashForSignature(inIndex, prevOutScript, hashType): Uint8Array

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: Uint8Array

hashType: number

Returns

Uint8Array

Defined in

ts_src/transaction.ts:295


hashForWitnessV0()

hashForWitnessV0(inIndex, prevOutScript, value, hashType): Uint8Array

Parameters

inIndex: number

prevOutScript: Uint8Array

value: bigint

hashType: number

Returns

Uint8Array

Defined in

ts_src/transaction.ts:526


hashForWitnessV1()

hashForWitnessV1(inIndex, prevOutScripts, values, hashType, leafHash?, annex?): Uint8Array

Parameters

inIndex: number

prevOutScripts: Uint8Array[]

values: bigint[]

hashType: number

leafHash?: Uint8Array

annex?: Uint8Array

Returns

Uint8Array

Defined in

ts_src/transaction.ts:372


isCoinbase()

isCoinbase(): boolean

Returns

boolean

Defined in

ts_src/transaction.ts:161


setInputScript()

setInputScript(index, scriptSig): void

Parameters

index: number

scriptSig: Uint8Array

Returns

void

Defined in

ts_src/transaction.ts:644


setWitness()

setWitness(index, witness): void

Parameters

index: number

witness: Uint8Array[]

Returns

void

Defined in

ts_src/transaction.ts:650


stripWitnesses()

stripWitnesses(): void

Returns

void

Defined in

ts_src/transaction.ts:220


toBuffer()

toBuffer(buffer?, initialOffset?): Uint8Array

Parameters

buffer?: Uint8Array

initialOffset?: number

Returns

Uint8Array

Defined in

ts_src/transaction.ts:636


toHex()

toHex(): string

Returns

string

Defined in

ts_src/transaction.ts:640


virtualSize()

virtualSize(): number

Returns

number

Defined in

ts_src/transaction.ts:232


weight()

weight(): number

Returns

number

Defined in

ts_src/transaction.ts:226


fromBuffer()

static fromBuffer(buffer, _NO_STRICT?): Transaction

Parameters

buffer: Uint8Array

_NO_STRICT?: boolean

Returns

Transaction

Defined in

ts_src/transaction.ts:82


fromHex()

static fromHex(hex): Transaction

Parameters

hex: string

Returns

Transaction

Defined in

ts_src/transaction.ts:143


isCoinbaseHash()

static isCoinbaseHash(buffer): boolean

Parameters

buffer: Uint8Array

Returns

boolean

Defined in

ts_src/transaction.ts:147