Post
Topic
Board Development & Technical Discussion
Re: Is this BIP65 sample script standard?
by
CIYAM
on 30/12/2015, 16:27:43 UTC
So far I have now come up with the following P2SH template:

76a82087637576a91488ac6703b17576a91488ac68

which can be better understood as this:

Code:
OP_DUP
OP_SHA256

OP_EQUAL
OP_IF
OP_DROP
OP_DUP
OP_HASH160

OP_EQUALVERIFY
OP_CHECKSIG
OP_ELSE

OP_NOP2
OP_DROP
OP_DUP
OP_HASH160

OP_EQUALVERIFY
OP_CHECKSIG
OP_ENDIF

Noting that:
is the SHA256 hash of the "secret"
is the public key hash for the "reveal secret" redeem script
is the block number for a CLTV refund to occur at and
is the public key hash for the "CLTV refund" redeem script

The lengths of things being pushed onto the stack has been hard-coded in this template which is fine for the hashes but would not be fine if you changed to instead be a timestamp (something I'll be looking into a little later).