Transaction
reddcoinjs-lib v7.0.1-rdd.1 • Docs
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
Properties
ins
ins:
TxInput[] =[]
Defined in
locktime
locktime:
number=0
Defined in
nTime
nTime:
number=0
Defined in
outs
outs:
TxOutput[] =[]
Defined in
version
version:
number=1
Defined in
ADVANCED_TRANSACTION_FLAG
readonlystaticADVANCED_TRANSACTION_FLAG:1=0x01
Defined in
ADVANCED_TRANSACTION_MARKER
readonlystaticADVANCED_TRANSACTION_MARKER:0=0x00
Defined in
DEFAULT_SEQUENCE
readonlystaticDEFAULT_SEQUENCE:4294967295=0xffffffff
Defined in
SIGHASH_ALL
readonlystaticSIGHASH_ALL:1=0x01
Defined in
SIGHASH_ANYONECANPAY
readonlystaticSIGHASH_ANYONECANPAY:128=0x80
Defined in
SIGHASH_DEFAULT
readonlystaticSIGHASH_DEFAULT:0=0x00
Defined in
SIGHASH_INPUT_MASK
readonlystaticSIGHASH_INPUT_MASK:128=0x80
Defined in
SIGHASH_NONE
readonlystaticSIGHASH_NONE:2=0x02
Defined in
SIGHASH_OUTPUT_MASK
readonlystaticSIGHASH_OUTPUT_MASK:3=0x03
Defined in
SIGHASH_SINGLE
readonlystaticSIGHASH_SINGLE:3=0x03
Defined in
Methods
addInput()
addInput(
hash,index,sequence?,scriptSig?):number
Parameters
• hash: Uint8Array
• index: number
• sequence?: number
• scriptSig?: Uint8Array
Returns
number
Defined in
addOutput()
addOutput(
scriptPubKey,value):number
Parameters
• scriptPubKey: Uint8Array
• value: bigint
Returns
number
Defined in
byteLength()
byteLength(
_ALLOW_WITNESS,_EXCLUDE_NTIME):number
Parameters
• _ALLOW_WITNESS: boolean = true
• _EXCLUDE_NTIME: boolean = false
Returns
number
Defined in
clone()
clone():
Transaction
Returns
Defined in
getHash()
getHash(
forWitness?):Uint8Array
Parameters
• forWitness?: boolean
Returns
Uint8Array
Defined in
getId()
getId():
string
Returns
string
Defined in
hasWitnesses()
hasWitnesses():
boolean
Returns
boolean
Defined in
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
hashForWitnessV0()
hashForWitnessV0(
inIndex,prevOutScript,value,hashType):Uint8Array
Parameters
• inIndex: number
• prevOutScript: Uint8Array
• value: bigint
• hashType: number
Returns
Uint8Array
Defined in
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
isCoinbase()
isCoinbase():
boolean
Returns
boolean
Defined in
setInputScript()
setInputScript(
index,scriptSig):void
Parameters
• index: number
• scriptSig: Uint8Array
Returns
void
Defined in
setWitness()
setWitness(
index,witness):void
Parameters
• index: number
• witness: Uint8Array[]
Returns
void
Defined in
stripWitnesses()
stripWitnesses():
void
Returns
void
Defined in
toBuffer()
toBuffer(
buffer?,initialOffset?):Uint8Array
Parameters
• buffer?: Uint8Array
• initialOffset?: number
Returns
Uint8Array
Defined in
toHex()
toHex():
string
Returns
string
Defined in
virtualSize()
virtualSize():
number
Returns
number
Defined in
weight()
weight():
number
Returns
number
Defined in
fromBuffer()
staticfromBuffer(buffer,_NO_STRICT?):Transaction
Parameters
• buffer: Uint8Array
• _NO_STRICT?: boolean
Returns
Defined in
fromHex()
staticfromHex(hex):Transaction
Parameters
• hex: string
Returns
Defined in
isCoinbaseHash()
staticisCoinbaseHash(buffer):boolean
Parameters
• buffer: Uint8Array
Returns
boolean