Space.W (OP)
Newbie
Offline
Activity: 3
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 15, 2021, 10:50:47 AM Last edit: August 16, 2021, 08:44:21 PM by Space.W |
|
Hi everybody, i see the error "operation not valid with the current stack size" if i try to broadcast after sign the transaction. Can anybody help please?
Hi guys, thanks for your feedback!
My wallet is electrum 4.1.5 standalone version. The raw transaction:
010000000133cfe4fee57a49c87aaebe6680f5df65d2e8415c0c40ee7182945b807e5ad3b501000 000b500483045022100d1c66bdd1e03de6da9fa93c3c51c7b33ebe8504a13ca2895cf5f9cae8c4f d9a402207cc95a120677e50c7f5ebd8077c12ee98962e881aac5877fac802770f9ec22b6014c695 2210218f5bd07a035c06f9dc996fccf6c506afeca47a254524c1ac5efd09bcd719e1f21021b27b5 61146058dab6da3a4dd9eb9d8741652eb000f4a543978a5c639da6e46e2103ca405f45cbc7e7bd4 ace4ee75a72cdaf439ff7607cc4a6a54894e2e65f6b196353aeffffffff01901805000000000019 76a9145a5f756f562f8aaf82e4569761f85c2a06f031c488ac00000000
The transaction is imported
|
|
|
|
BitMaxz
Legendary
Online
Activity: 3360
Merit: 3094
BTC price road to $80k
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 15, 2021, 11:30:12 AM |
|
I suggest you add more info about your wallet and where did you broadcast the signed transaction?
Does it seem this issue mostly appears on multisig wallets where did you generate the unsign raw transaction?
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18697
|
This error appears when the transaction has not been signed properly or completely. This most commonly occurs when you have a multi-sig transaction which has not been signed with the threshold number of keys. Another possibility is that you are using a wallet made up of imported private keys and have failed to import one of the private keys required for an input in the transaction you are trying to sign.
Are you willing to share your raw transaction hex here so we can take a look? Is your wallet standard, multi-sig, or imported keys? Did you generate this transaction from scratch in your own wallet, or did you import it from somewhere else?
|
|
|
|
sheenshane
Legendary
Offline
Activity: 2464
Merit: 1231
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 15, 2021, 04:03:04 PM |
|
I tend to agree with the post above mine, it's better to share your signrawtransaction if you don't mind so that members will try to figure out your problem and make sure you're decoding the right TX. If this staff member @achow101 will respond in your thread, I know he/she explained very well, I saw before it seems he is very expert on this. Just like on this thread, it seems familiar to your issue and it might help. https://bitcointalk.org/index.php?topic=1823847.0
|
|
|
|
pooya87
Legendary
Offline
Activity: 3556
Merit: 10820
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2021, 03:19:11 AM |
|
Leo's guess was right, now that you have posted the transaction it lacks the other signature.
Details: Your transaction is spending a P2SH output with a 2 of 3 multi-sig redeem script. While spending it the signature script only provides a single signature so when the script is being evaluated the evaluator knows that for a OP_CheckMultiSig with with m=2 and n=3 it needs 3 pubkeys, 2 signatures and a dummy item (OP_0) and when checking the stack it sees 1 item is missing hence the invalid message based on stack size.
To solve this you simply have to sign the transaction with one of the other 2 private keys (assuming your existing signature is valid, I didn't check).
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18697
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2021, 07:57:49 AM |
|
So as pooya has explained, the address 3EdE6sjQtr1p8DeroVCCPUqSRFBbN8vqWz is a 2-of-3 multi-sig. This means it was created using three different private keys, and any transactions spending coins from it must be signed with at least 2 of those private keys. Your wallet only contains one of those private keys. You will need to export your partially signed transaction and import it in to a wallet containing one of the other private keys to sign the transaction again and then broadcast it.
Do you remember how you created this wallet? Where else or who else did you set it up with?
|
|
|
|
Space.W (OP)
Newbie
Offline
Activity: 3
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2021, 08:43:12 PM |
|
Do you remember how you created this wallet? Where else or who else did you set it up with?
I created the wallet myself. Additionally, is it 2FA wallet (since 2FA wallet also use 2-of-3 multi-sig scheme)? You could find out by checking title of Electrum window application when you open the wallet. For example for standard wallet it's Electrum 4.1.2 - default_wallet [standard]
My wallet is Electrum 4.1.5 [standard] On a side note, i accidentally send 20 instead of 2 merit.
|
|
|
|
Space.W (OP)
Newbie
Offline
Activity: 3
Merit: 0
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2021, 08:55:48 PM |
|
Leo's guess was right, now that you have posted the transaction it lacks the other signature.
Details: Your transaction is spending a P2SH output with a 2 of 3 multi-sig redeem script. While spending it the signature script only provides a single signature so when the script is being evaluated the evaluator knows that for a OP_CheckMultiSig with with m=2 and n=3 it needs 3 pubkeys, 2 signatures and a dummy item (OP_0) and when checking the stack it sees 1 item is missing hence the invalid message based on stack size.
To solve this you simply have to sign the transaction with one of the other 2 private keys (assuming your existing signature is valid, I didn't check).
Leo's guess was right, now that you have posted the transaction it lacks the other signature.
Details: Your transaction is spending a P2SH output with a 2 of 3 multi-sig redeem script. While spending it the signature script only provides a single signature so when the script is being evaluated the evaluator knows that for a OP_CheckMultiSig with with m=2 and n=3 it needs 3 pubkeys, 2 signatures and a dummy item (OP_0) and when checking the stack it sees 1 item is missing hence the invalid message based on stack size.
To solve this you simply have to sign the transaction with one of the other 2 private keys (assuming your existing signature is valid, I didn't check).
Hi & thanks one more! You wrote, i need one of the other 2 private keys. How can i get this? isn't that the case that everyone has a private key and that it is confidential?
|
|
|
|
BitMaxz
Legendary
Online
Activity: 3360
Merit: 3094
BTC price road to $80k
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2021, 11:32:24 PM |
|
Hi & thanks one more! You wrote, i need one of the other 2 private keys. How can i get this? isn't that the case that everyone has a private key and that it is confidential?
How did you create your wallet? The raw transaction must be sent to another wallet that has control of that private key to sign the transaction. Do you remember if how did you create your multisig wallet? If you created this wallet on the same PC then you should open another wallet on the same PC and import this raw transaction to sign the transaction. What wallet do you currently use? if it's Electrum you can find the wallet file under C:\Users\Replacethiswithyourusername\AppData\Roaming\Electrum
|
|
|
|
pooya87
Legendary
Offline
Activity: 3556
Merit: 10820
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 17, 2021, 03:34:28 AM |
|
Hi & thanks one more! You wrote, i need one of the other 2 private keys. How can i get this? isn't that the case that everyone has a private key and that it is confidential?
Yes, private keys are "private" and must remain that way. Each bitcoin address is a script, usually they require a single signature from a single key to move the coins but you can create certain scripts that require more complicated actions such as requiring more than one signature from more than one private key. This is known as multi-signature address. The address can be created from n keys but require m signatures where m <= n. In your case, the address you have requires 2 signatures from 2 keys out of the total 3. You have signed the transactions once with one key and need to figure out how you created this wallet and where the other 2 keys are so that you can sign the transaction again with one of the other 2.
|
|
|
|
BlackHatCoiner
Legendary
Offline
Activity: 1624
Merit: 8018
Bitcoin is a royal fork
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 17, 2021, 12:52:07 PM |
|
Details: Your transaction is spending a P2SH output with a 2 of 3 multi-sig redeem script. Excuse from asking, but how did you get that? I decoded the transaction, but didn't see anything similar to a 2-of-3 multisig. I then thought that the M, N and pubkeys values are located in the redeem script, but I decoded that too and still no 2-of-3 multisig. It also says that the reqSigs are 1, which made me wonder how you concluded that. Thanks.
|
|
|
|
o_e_l_e_o
In memoriam
Legendary
Offline
Activity: 2268
Merit: 18697
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 17, 2021, 03:53:33 PM Last edit: August 17, 2021, 04:47:36 PM by o_e_l_e_o |
|
Excuse from asking, but how did you get that?
From the script. The first part of the script is the signatures, and the second part gives you the multi-sig requirements. Specifically, as follows: 4C - OP_PUSHDATA1 69 - Push 105 bytes 52 - OP_2 21 - Push 33 bytes 33 bytes of public key 1 21 - Push 33 bytes 33 bytes of public key 2 21 - Push 33 bytes 33 bytes of public key 3 53 - OP_3 AE - OP_CHECKMULTISIG So we can see 2 signatures are required from the 3 public keys.
|
|
|
|
BlackHatCoiner
Legendary
Offline
Activity: 1624
Merit: 8018
Bitcoin is a royal fork
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 17, 2021, 06:23:16 PM |
|
From the script. Which script? I decoded it as shown above, but I don't see any OP codes. Is it that "asm" that I have to decode?I've located those hexadecimal characters, but I don't know how to decode them.
|
|
|
|
|
pooya87
Legendary
Offline
Activity: 3556
Merit: 10820
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 18, 2021, 03:28:17 AM |
|
Which script? I decoded it as shown above, but I don't see any OP codes. Is it that "asm" that I have to decode? I've located those hexadecimal characters, but I don't know how to decode them.
That's because you should start from the output that is being spent so that you know how to interpret the signature script. When we know that the output type being spent is P2SH then we know that the top stack item is a redeem script. Then we know that redeem scripts are being pushed to the stack as you push any other arbitrary data (like pushing a hash). So when you just interpret the signature script (which is what the block explorers do) you only see the data pushes without the redeem script being interpreted separately for you to see those OP codes.
|
|
|
|
nc50lc
Legendary
Offline
Activity: 2520
Merit: 5989
Self-proclaimed Genius
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 18, 2021, 04:28:40 AM |
|
My wallet is electrum 4.1.5 standalone version. The raw transaction:
-snip-
The transaction is imported
Since the transaction has a signature, I assume that it was signed with one prvKey before the raw transaction ( HEX) is imported to Electrum. Now the issue: Electrum has a bug where you can immediately broadcast an imported RAW transaction ( except PSBT) whether it's signed correctly or not. If the transaction is in HEX, " broadcast" button will be available even if a transaction is unsigned/partially signed. But since it's invalid, the server where you're connected to wont relay it. With that, it should be signed once more by one of the other two cosigners.
|
|
|
|
pooya87
Legendary
Offline
Activity: 3556
Merit: 10820
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 18, 2021, 04:53:49 AM |
|
Now the issue: Electrum has a bug where you can immediately broadcast an imported RAW transaction (except PSBT) whether it's signed correctly or not.
It is not a bug, it is a feature of this SPV wallet. It doesn't verify the transaction before broadcasting because it could require downloading the UTXOs from the Electrum node first and also it has to have a complete implementation of bitcoin scripts and the evaluator to validate the transaction. So it is easier to just send the tx to the node and let the node itself fetch the UTXOs itself and verify it.
|
|
|
|
nc50lc
Legendary
Offline
Activity: 2520
Merit: 5989
Self-proclaimed Genius
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 18, 2021, 06:47:32 AM |
|
Now the issue: Electrum has a bug where you can immediately broadcast an imported RAW transaction (except PSBT) whether it's signed correctly or not.
It is not a bug, it is a feature of this SPV wallet. -snip-That's a weird feature then. Yes, maybe left it as it is because there was no efficient way to validate the transaction. There's now testmempoolaccept RPC which they can utilize to fix that, but not all servers use Bitcoin Core or supported Bitcoin Core versions. Good thing they moved to psbt.
|
|
|
|
pooya87
Legendary
Offline
Activity: 3556
Merit: 10820
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 18, 2021, 08:43:00 AM |
|
Yes, maybe left it as it is because there was no efficient way to validate the transaction.
Not just efficiency but I think the biggest problem is implementing a complete verifier which could verify transactions just like a full node would. That implementation is very hard and time consuming and you may end up with a lot of bugs.
|
|
|
|
HCP
Legendary
Offline
Activity: 2086
Merit: 4318
<insert witty quote here>
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 20, 2021, 02:22:31 AM |
|
I created the wallet myself. ... My wallet is Electrum 4.1.5 [standard]
The transaction is imported
So this transaction was not created by your Electrum wallet at all... you're just trying to broadcast the transaction using your Electrum wallet. So, the important question here is, where exactly did you import this transaction from? ![Huh](https://bitcointalk.org/Smileys/default/huh.gif) Did someone or some website/service send this to you claiming you could broadcast it to receive funds? If so, and you have given someone money/services/goods for it... you've probably been scammed. ![Undecided](https://bitcointalk.org/Smileys/default/undecided.gif) Or did you create this transaction yourself in another wallet? If so, what wallet? ![Huh](https://bitcointalk.org/Smileys/default/huh.gif)
|
|
|
|
|