Skip to main content

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​

Backtrace

Inherited from​

SmartContractLib.constructor

Properties​

args​

args: any[] = []

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:31

Inherited from​

SmartContractLib.args


artifact​

static artifact: Artifact

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:16

Inherited from​

SmartContractLib.artifact


stateType?​

static optional stateType: string

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:17

Inherited from​

SmartContractLib.stateType

Methods​

checkPrevTxHashPreimage()​

static checkPrevTxHashPreimage(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​

TxHashPreimage

The transaction hash preimage to verify

t_prevouts​

ByteString

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()​

static loadArtifact(artifact): typeof SmartContractLib

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:19

Parameters​

artifact​

Artifact

Returns​

typeof SmartContractLib

Inherited from​

SmartContractLib.loadArtifact


verifyChainTxs()​

static verifyChainTxs(backtraceInfo, t_prevTxInputList): ChainTxVerifyResponse

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/backtrace.ts:100

Tx chain verification to ensure:

  1. the current spending UTXO is the output of prevTx
  2. the specific input of prevTx is the output of prevPrevTx

Parameters​

backtraceInfo​

BacktraceInfo

backtrace info to verify, including prevTx and prevPrevTx preimages

t_prevTxInputList​

ByteString

input list of the prevTx which should be trustable

Returns​

ChainTxVerifyResponse

locking script and outpoint of the specified output of prevPrevTx


verifyFromOutpoint()​

static verifyFromOutpoint(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​

BacktraceInfo

backtrace info to verify, including prevTx and prevPrevTx informations

t_genesisOutpoint​

ByteString

expected genesis outpoint of the contract which usually is a contract property and trustable

t_selfScript​

ByteString

expected self locking script, i.e. this.ctx.spentScript, of the currect spending UTXO context which is trustable

t_prevTxInputList​

ByteString

input list of the prevTx which should be trustable

Returns​

void


verifyFromScript()​

static verifyFromScript(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​

BacktraceInfo

backtrace info to verify, including prevTx and prevPrevTx informations

t_genesisScript​

ByteString

expected genensis locking script which usually is a contract property and trustable

t_selfScript​

ByteString

expected self locking script, i.e. this.ctx.spentScript, of the current spending UTXO context and is trustable

t_prevTxInputList​

ByteString

input list of the prevTx which should be trustable

Returns​

void