Support User Transaction in sCrypt Debugger
We are happy to announce that sCrypt debugger now allows users to input their own transactions when debugging. This is essential when a contract written in sCrypt uses checkSig operation, which needs the current transaction to calculate and verify signature.
Below is an example configuration for debugging a contract. Besides attributes introduced before, there is a new attribute txContext with the following fields:
- hex: current transaction to be used in signature verification in hex format. It can be either signed or unsigned
- opReturn: initial data part of a stateful contract in ASM format. Multiple data pushes are allowed such as “00 1122 ffac”
- inputSatoshis: the amount of the UTXO referenced by the input, in satoshis
- inputIndex: index of the input in the transaction that is spending the UTXO containing our contract
Use Transaction from Testnet
We can debug contracts on the Bitcoin network. For instance, we deployed contract HashPuzzleP2PKH onto testnet using this code. It resulted in two transactions: one containing the contract in its output script and the other spending the output. From the spending transaction, we can easily find txContext and entryMethodParams. From the transaction being spent, we can identify constructorParams. The full debug configuration can be found here.