I'm trying to replicate an algebraic puzzle I saw in the scriptPubKey of a testnet transaction:


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:


  "txid": "4c56e2c6626e23f8d3afe7862332f3dbdef5e271f9931ecac8d8ffa67c43bf0b",
  "hash": "07662570c30e5505f35a328342ca6d0a3219ff2198814af44bfcc3dfad20d649",
  "version": 1,
  "size": 174,
  "vsize": 93,
  "weight": 369,
  "locktime": 0,
  "vin": [
      "txid": "5bc15b3ee96a3729030ef523cabcc15b97f815ecaf19c03568192fe11ed97536",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      "txinwitness": [
      "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:

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.)


1 Answer 1


You have to tell Bitcoin Core to allow non-standard transactions, This can be achieved by starting it with -acceptnonstdtxn.

  • Cool! It works! Now if I wanted to submit a similar spending transaction to testnet, I would spin up a testnet node here and submit the same way. But would the transaction propagate enough to get into a block somewhere (via gettemplateblock, right?)? Or do I have to mine my own block locally from templates from my local testnet node?
    – Dave M.
    May 4, 2022 at 17:52
  • Testnet allows non-standard transactions by default. You don't need to start with -acceptnonstdtxn on testnet, and any non-standard transactions you make should propagate.
    – Andrew Chow
    May 4, 2022 at 18:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.