Function getSequenceChallenge
Gets the challenge hash for the provided transaction, sequence ID.
geod24 .bitblob .BitBlob!(64L) getSequenceChallenge
(
in ref const(Transaction) tx,
in const(ulong) sequence,
in const(ulong) input_idx,
in const(ulong) output_idx = 0LU,
SigHash sig_hash = SigHash .NoInput
) nothrow @safe;
Parameters
Name | Description |
---|---|
tx | the transaction to sign |
sequence | the sequence ID to hash |
input_idx | the associated input index we're signing for |
Returns
the challenge as a hash
Example
OP.HASH_SHA256
scope engine = new Engine();
const tx = Transaction([Input .init], [Output .init]);
// sha256 hash of "abc"
ubyte[32] hash = [0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA, 0x41,
0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23, 0xB0, 0x03, 0x61, 0xA3, 0x96,
0x17, 0x7A, 0x9C, 0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD];
assert(engine .execute(
Lock(LockType .Script, [ubyte(OP .HASH_SHA256)] ~
toPushOpcode(hash) ~ [ubyte(OP .CHECK_EQUAL)]),
Unlock([ubyte(3), ubyte('a'), ubyte('b'), ubyte('c')]),
tx, Input .init) is null);