Backtrace
@opcat-labs/scrypt-ts-opcat v1.0.4
@opcat-labs/scrypt-ts-opcat / Backtrace
Class: Backtrace
Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:27
Library for verifying backtraces all the way to the genesis point.
Onchain
Extends
Constructors
new Backtrace()
new Backtrace(...
args):Backtrace
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:32
Parameters
args
...SupportedParamType[]
Returns
Inherited from
Properties
args
args:
any[] =[]
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:31
Inherited from
artifact
staticartifact:Artifact
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:16
Inherited from
stateType?
staticoptionalstateType:string
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:17
Inherited from
Methods
checkPrevTxHashPreimage()
staticcheckPrevTxHashPreimage(txHashPreimage,t_prevouts,t_inputIndex):void
Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:39
Verifies that the transaction hash preimage matches the previous transaction hash at the specified input index in the prevouts.
Parameters
txHashPreimage
The transaction hash preimage to verify
t_prevouts
The previous outputs containing the expected transaction hash
t_inputIndex
bigint
The index of the input to check against in prevouts
Returns
void
Throws
Will throw an error if the hashes don't match
loadArtifact()
staticloadArtifact(artifact): typeofSmartContractLib
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:19
Parameters
artifact
Returns
typeof SmartContractLib
Inherited from
verifyChainTxs()
staticverifyChainTxs(backtraceInfo,t_prevTxInputList):ChainTxVerifyResponse
Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:100
Tx chain verification to ensure:
- the current spending UTXO is the output of prevTx
- the specific input of prevTx is the output of prevPrevTx
Parameters
backtraceInfo
backtrace info to verify, including prevTx and prevPrevTx preimages
t_prevTxInputList
input list of the prevTx which should be trustable
Returns
locking script and outpoint of the specified output of prevPrevTx
verifyFromOutpoint()
staticverifyFromOutpoint(backtraceInfo,t_genesisOutpoint,t_selfScript,t_prevTxInputList):void
Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:56
Back-to-genesis backtrace verification for a contract which can be backtraced to the genesis outpoint. It will be a valid backtraceInfo if the prevPrevOutpoint is the genesis outpoint or the prevPrevScript is the selfScript.
Parameters
backtraceInfo
backtrace info to verify, including prevTx and prevPrevTx informations
t_genesisOutpoint
expected genesis outpoint of the contract which usually is a contract property and trustable
t_selfScript
expected self locking script, i.e. this.ctx.spentScript, of the currect spending UTXO context which is trustable
t_prevTxInputList
input list of the prevTx which should be trustable
Returns
void
verifyFromScript()
staticverifyFromScript(backtraceInfo,t_genesisScript,t_selfScript,t_prevTxInputList):void
Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:78
Back-to-genesis backtrace verification for a contract which can be backtraced to the genesis script. It will be a valid backtraceInfo if the prevPrevScript is the genesis script or the selfScript.
Parameters
backtraceInfo
backtrace info to verify, including prevTx and prevPrevTx informations
t_genesisScript
expected genensis locking script which usually is a contract property and trustable
t_selfScript
expected self locking script, i.e. this.ctx.spentScript, of the current spending UTXO context and is trustable
t_prevTxInputList
input list of the prevTx which should be trustable
Returns
void