Hi everyone !
I'm starting to experience with Bitcoin Core and I got really interested with Scripts. What I wanted to do is to use a custom puzzle in addition to the common scriptPubKey script, (i.e. need a solution + a private key to redeem the output).
I've managed so far to send a transaction on the testnet network with a 5+x=10 puzzle and my usual scriptPubKey script:
{
"txid": "033ca8bdb4f8d5944ef445719b32162f6df9beff3211a769eb0a2bceab2e9583",
"hash": "033ca8bdb4f8d5944ef445719b32162f6df9beff3211a769eb0a2bceab2e9583",
"size": 94,
"vsize": 94,
"version": 2,
"locktime": 0,
"vin": [
{
"txid": "b888efa3e07ae14ff758083be2abbb15e8126d5970341744c231f9c520d2ab78",
"vout": 0,
"scriptSig": {
"asm": "",
"hex": ""
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00004000,
"n": 0,
"scriptPubKey": {
"asm": "5 OP_ADD 10 OP_NUMEQUAL OP_DROP OP_DUP OP_HASH160 43e497c40f933af83d8a3fc6c92e92f26117a8af OP_EQUALVERIFY OP_CHECKSIG",
"hex": "4c0105934c010a9c7576a91443e497c40f933af83d8a3fc6c92e92f26117a8af88ac",
"type": "nonstandard"
}
}
]
}
So I'm trying to redeem this transaction with create/sign rawtransactions, but it seems I can't sign it even if I include the "5" solution:
{
"hex": "02000000010ce773f9e7d1c35485b0440a9982b652d08503cd666f24c753534717e0da92ee000000000155ffffffff01b80b0000000000001976a91443e497c40f933af83d8a3fc6c92e92f26117a8af88ac00000000",
"complete": false,
"errors": [
{
"txid": "ee92dae017475353c7246f66cd0385d052b682990a44b08554c3d1e7f973e70c",
"vout": 0,
"scriptSig": "55",
"sequence": 4294967295,
"error": "Data push larger than necessary"
}
]
}
I looked up for this error message but even if I try to change the redeem script to either OP_5 or 5 with OP_PUSHDATA1 it doesn't work...
I was wondering if any of you had an idea on how to do it ? :/ I think the best would be to manually sign the transaction but I really don't want to use librairies ><
Thank you for your time!