Operation not valid with the current stack size
up vote
1
down vote
favorite
According to bip65
https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
I can use expressions like IF ... ELSE ... ENDIF
Here is example script from this document:
IF
HASH160 <Hash160(encryption key)> EQUALVERIFY
<publisher pubkey> CHECKSIG
ELSE
<expiry time> CHECKLOCKTIMEVERIFY DROP
<buyer pubkey> CHECKSIG
ENDIF
But when I trying to spend transaction with the following script:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
https://tchain.btc.com/dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374
I get error:
bitcoin-cli -testnet sendrawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
error code: -26
error message:
mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16)
Where is my error ?
P.S.
SHA256 from 1 ->
4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
SHA256 from 2 ->
dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986
bitcoind script
add a comment |
up vote
1
down vote
favorite
According to bip65
https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
I can use expressions like IF ... ELSE ... ENDIF
Here is example script from this document:
IF
HASH160 <Hash160(encryption key)> EQUALVERIFY
<publisher pubkey> CHECKSIG
ELSE
<expiry time> CHECKLOCKTIMEVERIFY DROP
<buyer pubkey> CHECKSIG
ENDIF
But when I trying to spend transaction with the following script:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
https://tchain.btc.com/dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374
I get error:
bitcoin-cli -testnet sendrawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
error code: -26
error message:
mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16)
Where is my error ?
P.S.
SHA256 from 1 ->
4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
SHA256 from 2 ->
dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986
bitcoind script
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
According to bip65
https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
I can use expressions like IF ... ELSE ... ENDIF
Here is example script from this document:
IF
HASH160 <Hash160(encryption key)> EQUALVERIFY
<publisher pubkey> CHECKSIG
ELSE
<expiry time> CHECKLOCKTIMEVERIFY DROP
<buyer pubkey> CHECKSIG
ENDIF
But when I trying to spend transaction with the following script:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
https://tchain.btc.com/dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374
I get error:
bitcoin-cli -testnet sendrawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
error code: -26
error message:
mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16)
Where is my error ?
P.S.
SHA256 from 1 ->
4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
SHA256 from 2 ->
dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986
bitcoind script
According to bip65
https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
I can use expressions like IF ... ELSE ... ENDIF
Here is example script from this document:
IF
HASH160 <Hash160(encryption key)> EQUALVERIFY
<publisher pubkey> CHECKSIG
ELSE
<expiry time> CHECKLOCKTIMEVERIFY DROP
<buyer pubkey> CHECKSIG
ENDIF
But when I trying to spend transaction with the following script:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
https://tchain.btc.com/dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374
I get error:
bitcoin-cli -testnet sendrawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
error code: -26
error message:
mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16)
Where is my error ?
P.S.
SHA256 from 1 ->
4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
SHA256 from 2 ->
dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986
bitcoind script
bitcoind script
asked Dec 7 at 20:08
Andrew
766
766
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Your transaction only has 0x51
(just OP_1
) in its scriptsig, the OP_IF
consumes the 1
, and OP_SHA256
then operates on an empty stack, causing this error.
add a comment |
up vote
3
down vote
Like arubi said, you're scriptSig is just 0x51
:
$ bitcoin-cli decoderawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
{
"txid": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"hash": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"version": 2,
"size": 96,
"vsize": 96,
"weight": 384,
"locktime": 0,
"vin": [
{
"txid": "dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374",
"vout": 0,
"scriptSig": {
"asm": "1",
"hex": "51"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00120000,
"n": 0,
"scriptPubKey": {
"asm": "OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL",
"hex": "a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d98687",
"type": "nonstandard"
}
}
]
}
This means if the scriptPubKey
of the input you're spending is:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
It will execute this branch (since the top stack element is true):
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
You must also provide whatever hashes to the value 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
in order for it to return successfully.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "308"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f81736%2foperation-not-valid-with-the-current-stack-size%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Your transaction only has 0x51
(just OP_1
) in its scriptsig, the OP_IF
consumes the 1
, and OP_SHA256
then operates on an empty stack, causing this error.
add a comment |
up vote
4
down vote
accepted
Your transaction only has 0x51
(just OP_1
) in its scriptsig, the OP_IF
consumes the 1
, and OP_SHA256
then operates on an empty stack, causing this error.
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Your transaction only has 0x51
(just OP_1
) in its scriptsig, the OP_IF
consumes the 1
, and OP_SHA256
then operates on an empty stack, causing this error.
Your transaction only has 0x51
(just OP_1
) in its scriptsig, the OP_IF
consumes the 1
, and OP_SHA256
then operates on an empty stack, causing this error.
answered Dec 7 at 20:12
arubi
1,024113
1,024113
add a comment |
add a comment |
up vote
3
down vote
Like arubi said, you're scriptSig is just 0x51
:
$ bitcoin-cli decoderawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
{
"txid": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"hash": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"version": 2,
"size": 96,
"vsize": 96,
"weight": 384,
"locktime": 0,
"vin": [
{
"txid": "dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374",
"vout": 0,
"scriptSig": {
"asm": "1",
"hex": "51"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00120000,
"n": 0,
"scriptPubKey": {
"asm": "OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL",
"hex": "a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d98687",
"type": "nonstandard"
}
}
]
}
This means if the scriptPubKey
of the input you're spending is:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
It will execute this branch (since the top stack element is true):
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
You must also provide whatever hashes to the value 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
in order for it to return successfully.
add a comment |
up vote
3
down vote
Like arubi said, you're scriptSig is just 0x51
:
$ bitcoin-cli decoderawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
{
"txid": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"hash": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"version": 2,
"size": 96,
"vsize": 96,
"weight": 384,
"locktime": 0,
"vin": [
{
"txid": "dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374",
"vout": 0,
"scriptSig": {
"asm": "1",
"hex": "51"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00120000,
"n": 0,
"scriptPubKey": {
"asm": "OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL",
"hex": "a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d98687",
"type": "nonstandard"
}
}
]
}
This means if the scriptPubKey
of the input you're spending is:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
It will execute this branch (since the top stack element is true):
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
You must also provide whatever hashes to the value 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
in order for it to return successfully.
add a comment |
up vote
3
down vote
up vote
3
down vote
Like arubi said, you're scriptSig is just 0x51
:
$ bitcoin-cli decoderawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
{
"txid": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"hash": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"version": 2,
"size": 96,
"vsize": 96,
"weight": 384,
"locktime": 0,
"vin": [
{
"txid": "dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374",
"vout": 0,
"scriptSig": {
"asm": "1",
"hex": "51"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00120000,
"n": 0,
"scriptPubKey": {
"asm": "OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL",
"hex": "a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d98687",
"type": "nonstandard"
}
}
]
}
This means if the scriptPubKey
of the input you're spending is:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
It will execute this branch (since the top stack element is true):
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
You must also provide whatever hashes to the value 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
in order for it to return successfully.
Like arubi said, you're scriptSig is just 0x51
:
$ bitcoin-cli decoderawtransaction 020000000174c3e24cbc6f8a0633e55f055e1747127e91f5b6e1157fc059e1b700b777f4db000000000151ffffffff01c0d401000000000023a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d9868700000000
{
"txid": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"hash": "2e7c6efc9dc6104f132a10d0d64263269d1ece326b4d64cb1061fe5a81b4d53b",
"version": 2,
"size": 96,
"vsize": 96,
"weight": 384,
"locktime": 0,
"vin": [
{
"txid": "dbf477b700b7e159c07f15e1b6f5917e1247175e055fe533068a6fbc4ce2c374",
"vout": 0,
"scriptSig": {
"asm": "1",
"hex": "51"
},
"sequence": 4294967295
}
],
"vout": [
{
"value": 0.00120000,
"n": 0,
"scriptPubKey": {
"asm": "OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL",
"hex": "a820dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d98687",
"type": "nonstandard"
}
}
]
}
This means if the scriptPubKey
of the input you're spending is:
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
OP_ELSE
10 OP_CHECKLOCKTIMEVERIFY OP_DROP OP_SHA256 dbc1b4c900ffe48d575b5da5c638040125f65db0fe3e24494b76ea986457d986 OP_EQUAL
OP_ENDIF
It will execute this branch (since the top stack element is true):
OP_IF
OP_SHA256 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a OP_EQUAL
You must also provide whatever hashes to the value 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
in order for it to return successfully.
edited Dec 7 at 21:09
answered Dec 7 at 20:29
JBaczuk
3,9261321
3,9261321
add a comment |
add a comment |
Thanks for contributing an answer to Bitcoin Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fbitcoin.stackexchange.com%2fquestions%2f81736%2foperation-not-valid-with-the-current-stack-size%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown