CounterpartyXCP / counterwallet

Counterparty web wallet
https://counterwallet.io
147 stars 162 forks source link

Unable to sign multisig transaction with a 2-of-3 #714

Open ivanaszuber opened 9 years ago

ivanaszuber commented 9 years ago

Signing a 2-of-3 results in an error

Type: Server error Code: -32000 Message: Bad status code returned: '500'. result body: '{"result":null,"error":{"code":-26,"message":"16: mandatory-script-verify-flag-failed (Operation not valid with the current stack size)"},"id":0} '.

Signing a 1-of-2 works without issues.

Another user reported the following error when trying to sign and broadcast a transaction from a 2-of-3:

Error making request to https://cw02.counterwallet.io/_api: JSON-RPC Error: Type: Server error Code: -32000 Message: Bad status code returned: '500'. result body: '{"result":null,"error":{"code":-25,"message":""},"id":0} '.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/9106721-unable-to-sign-multisig-transaction-with-a-2-of-3?utm_campaign=plugin&utm_content=tracker%2F542579&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F542579&utm_medium=issues&utm_source=github).
Daruhshie commented 9 years ago

I'm am not able to sign any multi-sig transactions 1/2 or 2/3 with addresses from any wallets including, blockchain.info, armory, electrum or the counterwallet itself.

shaulkf commented 9 years ago

Can you paste the transaction? The mandatory-script-verify-flag-failed (Operation not valid with the current stack size) will typically show when you're missing a signature, the bitcoind interpreter tries to pop a signature from the stack during OP_CHECKMULTISIG / OP_CHECKMULTISIGVERIFY and can't find one.

ivanaszuber commented 9 years ago

Update on this issue.

Just tested sending funds from a 2-of-2 on testnet. When signing the transaction with the first address an error pops

Error making request to https://testnet.counterwallet.co/_t_api: JSON-RPC Error:
Type: Server error

Code: -32000

Message: Bad status code returned: '500'. result body: '{"result":null,"error":{"code":-26,"message":"16: mandatory-script-verify-flag-failed (Operation not valid with the current stack size)"},"id":0} '.

But if you ignore the error and sign with the second address, you get Your transaction was broadcasted successfully, and indeed it was.

So it seems the issue is only with the message that pops, signing transactions works.

rubensayshi commented 8 years ago

@ivanaszuber afaik this has long been solved, could you check?

vroomDotClub commented 7 years ago

STILL NOT SOLVED THIS FKN SUCKS! same exact error reported for me had to keep trying not sure wat the heck is wrong but this stuff is not working right for any normal user and i tweeted to authors bout this months ago nobody gives a crap really coinb.in will not be recco'd by me to anynone.

unsystemizer commented 7 years ago

@vroomDotClub I think changes it Bitcoin Core made this not work.

Annoyingly there is no easy debug mode for "the back end" in CounterWallet so even if you set one up at home, it's a painful to find out what is not working.

rubensayshi commented 7 years ago

Bitcoin Core has made multisig non standard in many cases, it requires the transaction size : sigops ratio to be above a certain threshold for it to work atm.

The best way to acomplish this is adding some P2PKH inputs, alternatively if you contact me on Slack or IRC and give me the raw, signed, TX I can get it mined for you

cryptcoin-junkey commented 3 years ago

I encountered mandatory-script-verify-flag-failed on Monacoin version of Counterwallet. In my case, this is caused by unsuitable float calculation.

Math.floor(parseFloat("0.29810232") * 1e8) results 29810231 . So signature becomes invalid. I found similar issue on Bitcoin-core https://github.com/bitcoin/bitcoin/issues/11891 .