0

I created the following non-standard Tx on the Testnet3 network: 6b52c981e6814072db77cb755b2633cd126b4ca21501d18ab994531e17a4a813

{
hash: "6b52c981e6814072db77cb755b2633cd126b4ca21501d18ab994531e17a4a813",
ver: 1,
vin_sz: 1,
vout_sz: 1,
lock_time: 0,
size: 234,
in: [
{
prev_out: {
hash: "a61a8bd4aaab2aa935f2e62672a783ca936821c94e021caed747d3ff8b658ff7",
n: 0
},
scriptSig: "3045022100b4b97d5f21efa866ffc25ae4e20b4427adbeffca0fb8ea5d90ef261e1050c43e022077d1e734b077630b3634f91b2d60eb267f4a4e3e25ad9a0f56825363eee0fdc001 04dcc0cf808a5313ee50185575a850738011730247273aa3e11f400f7904e01fda86383ff0e8ed2ba201cb6cfb974d6148199ffc635d92b92b834ec04885bb9a71"
}
],
out: [
{
value: "0.00080000",
scriptPubKey: "OP_SHA256 931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d8 OP_EQUAL"
}
]
}

The output of interest, is: "OP_SHA256 931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d8 OP_EQUAL".

hashed 'secret' = adfladsfhuifo8ry8fh4u4et4e5tsg415et458s43etg41s35e4g3541r35g143sg54s385g41s535e1g435s4g;.:;,[@snrltgnjslenjrgklsnleignilsnklgnslnglk

sha256(secret) = 931d236179670b00348f87bea4199fe18297f0ef26da02c7542bd54d5b7836d8

The BTC Wiki Script page (namely, Puzzle Tx section) provides a high-level discussion (of DOUBLE SHA256, note this is just SHA256 ie 0xa8. This BTCtalk discussion provides the aforementioned secret, raw Tx format, etc.


I am trying to redeem 010000000113a8a4171e5394b98ad10115a24c6b12cd33265b75cb77db724081e681c9526b0000000000ffffffff01204e000000000000864c846164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b00000000

{
"txid" : "717b0d0db10f79d38553d2aeda3994768fda306fa5331d055fb3cf00818a6d7e",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "6b52c981e6814072db77cb755b2633cd126b4ca21501d18ab994531e17a4a813",
"vout" : 0,
"scriptSig" : {
"asm" : "",
"hex" : ""
},
"sequence" : 4294967295
}
],
"vout" : [
{
"value" : 0.00020000,
"n" : 0,
"scriptPubKey" : {
"asm" : "6164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b",
"hex" : "4c846164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b",
"type" : "nonstandard"
}
}
]
}

So, it's looks fine, right?

Well, signing (with signrawtransaction) returns hex data with a false flag for complete. Furthermore, both signed and unsigned hex strings return this error:

  • 16: mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code -26)

Has anyone got any insight into what the issue may be, and, perhaps more helpfully to everyone else, assuming P2SH is not an option, how does one redeem these outputs?

1 Answer 1

2

So, it's looks fine, right?

No. It does not look fine. You have to put your 'secret' into scriptSig. And your scriptPubkey should be redeem to one of your addresses (for example to msimoNvz23QXyiRofLtGSCsVdkdsNJn4SU). You should not try to sign this transaction - redeeming it does not require ecdsa signature

something like this: (sorry, I did it "by hands", so it may be incorrect)

01000000
01 
13a8a4171e5394b98ad10115a24c6b12cd33265b75cb77db724081e681c9526b
00000000

86    // length of script
4c84  // push 0x84 following bytes
6164666c61647366687569666f38727938666834753465743465357473673431356574343538733433657467343173333565346733353431723335673134337367353473333835673431733533356531673433357334673b2e3a3b2c5b40736e726c74676e6a736c656e6a72676b6c736e6c6569676e696c736e6b6c676e736c6e676c6b
ffffffff

01                 // one output
204e000000000000   // value in hex
19                 // length
76 A9 14 85ddbd9c2f9733dc3860b9e1ffcdc0da2633004b 88 AC // redeem to msimoNvz23QXyiRofLtGSCsVdkdsNJn4SU

00000000
1
  • Of course! That makes sense. The confusion was arising initially bc signing wasn't required but in hindsight I see the redemption is sitting in for the signature, which makes sense. And clearly the Tx is a mess, given that outputs / inputs are either missing completely or swapped in place. I'll try it out within the hour. Mar 4, 2015 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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