I'm trying to replicate an algebraic puzzle I saw in the scriptPubKey of a testnet transaction:
OP_2DUP OP_ADD 6e OP_EQUAL
I think the intent was for this output to be spendable by a scriptSig of 0x37
, but the author used OP_2DUP
instead of OP_DUP
. I think you should still be able to spend this with a scriptSig of 0x37 0x37
, although the stack after execution will have 1 0x37 0x37
instead of just 1
.
I wasn't able to submit a testnet transaction to try to spend the output, because bitcoin-cli sendrawtransaction
enforces the non-mandatory-script-verify-flag
(Stack size must be exactly one after execution). So my next thought was to replicate the puzzle on a regnet server, and see if I could spend the coins there.
I created a raw transaction (funded from a different regnet output) with the corrected script:
010000000001013675d91ee12f196835c019afec15f8975bc1bcca23f50e0329376ae93e5bc15b0000000000ffffffff01c808e30500000000057693016e870247304402207f369a50b6deecaf6fc0ee15037ffe460eea9d9093d8e889def1ad93f173d11b022042dac5b3db93aa665b4d45073a3c397e4cdbdbd25880d6a8a15f97cc70b0228f0121029972f24e39b359e5e29267fab7d4cf752982f95e3428b0ef14f38937e6084c3f00000000
{ "txid": "4c56e2c6626e23f8d3afe7862332f3dbdef5e271f9931ecac8d8ffa67c43bf0b", "hash": "07662570c30e5505f35a328342ca6d0a3219ff2198814af44bfcc3dfad20d649", "version": 1, "size": 174, "vsize": 93, "weight": 369, "locktime": 0, "vin": [ { "txid": "5bc15b3ee96a3729030ef523cabcc15b97f815ecaf19c03568192fe11ed97536", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "304402207f369a50b6deecaf6fc0ee15037ffe460eea9d9093d8e889def1ad93f173d11b022042dac5b3db93aa665b4d45073a3c397e4cdbdbd25880d6a8a15f97cc70b0228f01", "029972f24e39b359e5e29267fab7d4cf752982f95e3428b0ef14f38937e6084c3f" ], "sequence": 4294967295 } ], "vout": [ { "value": 0.98765000, "n": 0, "scriptPubKey": { "asm": "OP_DUP OP_ADD 110 OP_EQUAL", "desc": "raw(7693016e87)#tcc664ka", "hex": "7693016e87", "type": "nonstandard" } } ] }
But I can't submit this transaction to my regnet server either, because:
% bitcoin-cli sendrawtransaction 010000000001013675d91ee12f196835c019afec15f8975bc1bcca23f50e0329376ae93e5bc15b0000000000ffffffff01c808e30500000000057693016e870247304402207f369a50b6deecaf6fc0ee15037ffe460eea9d9093d8e889def1ad93f173d11b022042dac5b3db93aa665b4d45073a3c397e4cdbdbd25880d6a8a15f97cc70b0228f0121029972f24e39b359e5e29267fab7d4cf752982f95e3428b0ef14f38937e6084c3f00000000 error code: -26 error message: scriptpubkey
Do I have to write my own submitter to talk to the regnet node? (Perhaps I'll need that anyway to submit the answering / spending transaction.)
(I think I can submit nonstandard scripts via P2SH, but that's not what I want, because the puzzle script itself needs to be in the blockchain, not just the answer script's hash. That's the whole point of having a puzzle / reward / challenge: anyone can read the problem statement, and if they can solve it, they can submit a transaction where the scriptsig pushes the answer(s). I understand that this is not secure, and that a mining pool could steal the answer and submit it with their own pay-to address as the output, but that's a problem for another day.)
Help!
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments