spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.43k stars 3.09k forks source link

problems with very large transaction with thousands of inputs #4417

Closed mik87 closed 6 years ago

mik87 commented 6 years ago

Hello dear sirs !

Today I see strange issue with use Electrum 3.1.3 portable client. I cannot sent any transaction . When I try send & sign I see this message: "This transaction requires a higher fee, or it will not be propagated by your current server Try to raise your transaction fee, or use a server with a lower relay fee." Once I try make more comission it's up to $45 + per 1 transaction. For example 1 hour ago when I try send 100 mBTC , Electrum says: Miner comission: 7.84 mBTC which too high for this action. I tried change server to another, tried change node...nothing help. Same message. But even when I try send it with recommend comission - it's stay 30-40 mins with status "sign transaction" and nothing happened. I not change anything on my PC. Tried reinstall Electrum (delete old and download new file), tried reboot PC, tried do it from another PC , check all system on malware/adware, even setup purse on new laptop with fresh OS - nothing help. Yesterday and even today morning 9-10 AM all was good. Nothing was changed on settings. And one more issue which I noticed - all process on Electrum started to slow down a bit (maybe DDoS) ?Tried with OS Windows 8, 7 and 10 = same effect, nothing changed. It's normal situation ? Thank you!

AbdussamadA commented 6 years ago

what is the size of the transaction in bytes? it may be displayed on the send tab depending on your fee settings. if it isn't click on preview and you'll see it there.

mik87 commented 6 years ago

Hi Abdussamad! It's imposible even preview. Once I put preview button - I got same message: "This transaction requires a higher fee, or it will not be propagated by your current server Try to raise your transaction fee, or use a server with a lower relay fee." If I up comission - for example I try sent 100 mBTC now, it's show me: Size: 196100 Comission miner: 17648.82 mBTC (8. sat/byte) . So it's 2 problem , if I put low (standard) comission fees - I cannot do anything and always see this message about "This transaction requires a higher fee. " If I put high comission - I just wait for hour with status "transaction signature" and nothing happened.......so this way impossible use Electrum. :(

SomberNight commented 6 years ago

196100 bytes = 196.1 kByte? wow. That must be like a thousand inputs.. What have you done with this wallet? Are these mining shares from a pool?

This raises several points:

  1. 1 sat/byte is the default relay fee of nodes in the Bitcoin network; you will have to pay at least that!
  2. Transactions over 100 kByte are non-standard in the default policy of nodes. This means they will NOT be relayed or mined.
  3. Signing a transaction in Electrum, depending on your machine, takes maybe about 0.5 seconds per input, so signing this full tx might take like 10 minutes. This will be a LOT faster in the next release btw.

My advice then would be:

  1. set the fee rate to 1 sat/byte; you will not be able to spend less on fees
  2. make sure the transaction size is NOT over 100 kByte. either enable the Coins tab in Electrum and manually choose which inputs to spend, or choose the destination amount you are sending so that this criterion holds
  3. be patient when signing the transaction
AbdussamadA commented 6 years ago

To elaborate on what @SomberNight said above to set the fee rate manually go to tools > preferences > fees tab and check edit fees manually. Then on the send tab you'll have the option to set the fee rate.

To select specific utxos aka coins go to view menu > show coins and then on the coins tab shift or ctrl click some subset of utxos, right click and choose spend to create a transaction that spends just those utxos.

SomberNight commented 6 years ago

Closing; not much left to say.

lunarovic commented 6 years ago

@SomberNight I'm sorry, but how is this correct?

1 sat/byte is the default relay fee of nodes in the Bitcoin network; you will have to pay at least that!

In every block I see many transactions which have paid a fee less than 1 sat/byte, and they're even included in the first block, after just a couple of minutes.

Examples: https://blockchain.info/tx/d4ce37fe3733410792484194fc4fac6ae470ed818d638ebb52f506716df8c3e5 https://blockchain.info/tx/0688639de78bf5b6e193476b7ef2e13c5443d6a1bf5db91b46743eeedf860634

I've run into this issue with Electrum when I tried to send a transaction with less than 1 sat/byte, but it doesn't allow me, even though my transaction only had around 370 bytes. I see the same error as the OP, even when just clicking on the Preview button:

This transaction requires a higher fee, or it will not be propagated by your current server Try to raise your transaction fee, or use a server with a lower relay fee.

This leads me to believe that it doesn't have anything to do with Bitcoin, but with the Electrum servers having a minimum of 1 sat/byte, because obviously we see transactions with less than that getting into blocks normally. I tried switching to about a dozen of different Electrum servers, but the same error remains.

So this seems to be an issue with the Electrum servers or possibly the Electrum client. Should a new GitHub issue be opened for it?

SomberNight commented 6 years ago

@lunarovic Both transactions you linked are paying at least 1 satoshi per virtual byte. blockchain info is calculating the wrong thing. Multiply "Fee per weight unit" by 4, and you get "fee per virtual byte" which is what matters.

I linked you to the bitcoin core source code to back up my claim of the default value and you link some random transaction to contradict it? :) Further, I am talking about relaying, and policy. Some random transaction that gets mined is only proof of being within consensus rules, not policy. The consensus rules allow any transaction regardless of fee to be mined but the default policy of nodes is not to relay transactions that pay less than 1 sat/vbyte.

Also, even if it was a problem with the settings of Electrum servers, they are run by volunteers (you could run one too!), who can configure them any way they want. You could run a server that specifically relays zero-fee transactions. (though it would not help much as they would most likely be stopped by the next peer you have)

lunarovic commented 6 years ago

@SomberNight Thank you for the response. I admit, this is the first time I hear about the term "vbytes", but it seems you too are not using that term almost anywhere else (except in #4042, which seems to be a relevant issue), so don't you agree it's confusing? Yourself have probably used the "incorrect" term "bytes" instead of "vbytes" a lot of times. And it's especially confusing because blockchain.info shows vbytes as bytes.

I'm not a complete newbie with all the tech intricacies of Bitcoin, so I know about bytes and weight, I am just surprised that the most popular block explorer is displaying it incorrectly, that's all. Now I know how to look at their data and thank you for explaining it to me. However, it seems you missed my point, so in this comment I will try to be clearer.

I linked you to the bitcoin core source code to back up my claim of the default value and you link some random transaction to contradict it? :)

You tempted me to show you another transaction. :P But I will just say this, and you know it: a lot of the transactions from 2014 had 0 fees, not to mention something like 2011 (almost all of them). And fortunately, when you multiply 0 by 4, it's still zero. :) 0 per byte, vbyte, weight unit...

I have a couple of ideas why the fees could be zero again, hopefully they will make sense. For example, the lightning network could become so large and popular, that the blockchain would be used just for opening/closing channels and some very large transactions. Imagine that blocks would not be completely filled anymore at all, but only like a third at most. Another example is what if Bitcoin hits $100K or $1M? 1 sat per vbyte would reach levels of current bank transaction fees, especially for larger transactions, and that's only the minimum.

I linked you to the bitcoin core source code to back up my claim of the default value

So I didn't comment on your linked line of source code because we know that transaction fees have definitely been less than 1 sat/byte in the past. And especially seeing that it's just a default value, which can be changed with an argument when starting the node or in the conf file, and it was introduced in v0.14, so fairly recently.

But judging by that commit, I don't think you referred to the right feature. Incremental relay fee may just be what I was looking for, it looks like it's used to somehow dynamically adjust the relay fee in increments. Maybe this is why Electrum servers shouldn't have the value constant at 1000, but that's out of scope for my level of research. However, I think the thing you wanted to refer to is not that, but this:

-blockmintxfee=<amt>
Set lowest fee rate (in BTC/kB) for transactions to be included in block creation.
(default: 0.00001)

Or the deprecated one:

-minrelaytxfee=<amt>
Fees (in BTC/kB) smaller than this are considered zero fee for relaying, mining and transaction creation
(default: 0.00001)

(I've also learned about dustrelayfee which may be of relevance to the OP's issue here.)

Also, see this: https://bitcoin.org/en/release/v0.14.0#minimum-fee-rate-policies

If miners wish to set this minimum they can use the new -blockmintxfee option. (defaults to 1000 satoshis/kB)

You're talking about policy vs. consensus, but miners are obviously allowed to change their policy and lower the minimum fee for relaying and block creation.

You could run a server that specifically relays zero-fee transactions. (though it would not help much as they would most likely be stopped by the next peer you have)

So you're saying I effectively can't run a server which relays zero-fee transactions? :) But the issue here is that Electrum locally disallows creating transactions with very low fees. That should be left for the miners to decide if they want to include those transactions or not, but they should be created, and also relayed if there are servers which want to relay them, regardless of the default policy.

Yes, maybe the transaction will be relayed only to one server and stop there or not relayed at all because there isn't an Electrum server which will accept it, but I can always try to broadcast my transaction by using any of these tools: https://blockchain.info/pushtx https://live.blockcypher.com/btc/pushtx/ https://blockexplorer.com/tx/send

However, the problem is that I can't sign and export the transaction from Electrum, since it doesn't allow me. The Preview button returns an error if the fee is too low. My opinion is that the fee amount is none of the Preview button's concern, because that button opens up a multi-functional dialog, which doesn't have the sole purpose of just broadcasting the transaction, but also signing it and exporting the hex. And the relay error should only be presented when you want to broadcast the transaction and the server doesn't accept it.

SomberNight commented 6 years ago

So you're saying I effectively can't run a server which relays zero-fee transactions? :) But the issue here is that Electrum locally disallows creating transactions with very low fees.

Electrum asks the server for the minimum relay fee it is using, and uses that (with a fallback to 1 sat/vbyte if the server did not tell us).

https://github.com/spesmilo/electrum/blob/88d95123fb0d1817804b6c8712dfbf4e7fd45254/lib/wallet.py#L82-L86

My opinion is that the fee amount is none of the Preview button's concern

Ok, yes, I guess there should at least be a way to create these very low fee txns.

But this discussion here is now off topic here I would say, and more fitting to the referenced https://github.com/spesmilo/electrum/issues/4042

lunarovic commented 6 years ago

But this discussion here is now off topic here I would say, and more fitting to the referenced #4042

I agree, move the comments there if possible, if not, I could write just the last paragraph from my long comment, if that's the crux of the issue.