Scripts
import { Script, PrivateKey, P2PKH, OP } from '@bsv/sdk'Generating and Deserializing Scripts
// From Hex
const buf: number[] = [OP.OP_TRUE]
const scriptFromHex = Script.fromHex(Utils.toHex([OP.OP_TRUE]))
// From ASM
const scriptFromASM = Script.fromASM('OP_DUP OP_HASH160 1451baa3aad777144a0759998a03538018dd7b4b OP_EQUALVERIFY OP_CHECKSIG')
// From Binary
const buf2 = [OP.OP_PUSHDATA1, 3, 1, 2, 3]
const scriptFromBinary = Script.fromBinary(buf)Serializing Scripts
Last updated
Was this helpful?

