free web page hit counter
Introspection opcodes are so cool, here's a teaser

Introspection opcodes are so cool, here's a teaser

Bitcoin Reddit

More / Bitcoin Reddit 44 Views

Below is an example of a covenant contract owned by another contract. Whatever sibling contract is created as the 2nd (index 1) output will be the owner of the 1st (index 0) output. This way, ownership of the contract can be changed without changing the P2SH hash.

This contract is an idea I was toying with before, but now I got to test it and it worked, eureka!

Testnet4 transaction: https://testnet4.imaginary.cash/tx/604a148eb49c83855e209c9ca46ff1b32517561c3a6209d41113f4c6d99193be

Redeem script:
OP_SIZE <64> OP_EQUAL OP_SWAP OP_DROP
raw: 82 01 40 87 7c 75 // Verify that my data is of 64 bytes
<0> OP_INPUTINDEX OP_EQUAL OP_BOOLAND
raw: 00 c0 87 9a // Verify that I'm being spent as index 0 input
<0> OP_OUTPOINTINDEX <0> OP_EQUAL OP_BOOLAND
raw: 00 c9 00 87 9a // Verify that my prevout index is 0
<1> OP_OUTPOINTINDEX <1> OP_EQUAL OP_BOOLAND <0> OP_OUTPOINTTXHASH <1> OP_OUTPOINTTXHASH OP_EQUAL OP_BOOLAND
raw: 51 c9 51 87 9a 00 c8 51 c8 87 9a // Verify that my owner is spent at input index 1
<0> OP_OUTPUTBYTECODE <0> OP_UTXOBYTECODE OP_EQUAL OP_BOOLAND
raw: 00 cd 00 c7 87 9a // Verify that I'm being carried forward to output at index 0.

Raw: 820140877c7500c0879a00c900879a51c951879a00c851c8879a00cd00c7879a
Hash160 of redeem script: b6657f37cad003b75ffea87066f0434bcace0d6c

Signature: <data64>

submitted by /u/bitcoincashautist
[link] [comments]

GET CARD FOR FREE NOW!

Comments