Script:
OP_OVER OP_TOALTSTACK <pubkey> OP_DUP OP_TOALTSTACK OP_CHECKDATASIGVERIFY OP_FROMALTSTACK OP_FROMALTSTACK OP_SWAP OP_CHECKSIG
Stack:
<sig> <msg>
<sig> <msg> <sig>
<sig> <msg>
<sig> <msg> <pubkey>
<sig> <msg> <pubkey> <pubkey>
<sig> <msg> <pubkey>
(empty)
<pubkey>
<pubkey> <sig>
<sig> <pubkey>
1
The only missing part is checking if <msg>
is a valid transaction with correct outputs. We can ensure that the output script is exactly the same, then it will form a Quine! Did I miss something, or is it possible? Now I am trying to test that.