Bitcoin Forum

Other => Beginners & Help => Topic started by: RexBrocki on April 24, 2013, 07:54:05 PM



Title: problem with bitcoin payment fees
Post by: RexBrocki on April 24, 2013, 07:54:05 PM
Hello Everyone,

I'm having a weird problem with bitcoin fees.

I am attempting to transfer a balance of .40132441 from one of my early wallets (original bitcoin client, ver 0.6.3 beta) to another (I'm consolidating before upgrading... unless that's a bad idea?).

Being a proper cheapskate (my parents grew up during the great depression... if you don't know what that means, you're lucky), I first attempted to send the transaction for free.  Predictably, no soap.

I then went back into wallet settings and reset the fee to the lowest auto-generated amount of .001 bitcoin, adjusted the send amount to match, and tried again... and then the fun began.

This time a little screen popped up saying that "This transaction exceeds your balance when the fee of .00125 bitcoins is included."  So I went back and changed the send amount again to accommodate the extra .00125 bitcoins... and this time, the little screen demanded .0025 bitcoins, or twice the original fee!

This pattern continued with ever-increasing fees demanded until it had reached .025 bitcoins, twenty times the original fee, when the only different screen appeared, saying "This transaction is too large.  You can still send it by adding a fee of .0095 bitcoins."  Anyone who is perplexed by the question of why the software would demand .0095 bitcoins when the offered fee was already more tyhan two-and-a-half times as much... congratulations!  You're now almost as confused as I am!

After that single blip, the messages resumed their previous pattern of larger and larger fees requested, until I called a halt at .2378 bitcoins, which is over $40 by this morning's fix, and over half the balance of the ruddy wallet!

I then went and discovered that my original username ("TheVoiceofLiberty," if anyone remembers me) has somehow wandered off into cyberspace over the last six months, so I'm back to the newbie forum with my right name.

The operating system is Microcrap Windblows XT, build 3 (Yes, I know, and I'm already using ubuntu on the eventual destination machine, but these two old POS's would probably break down and cry if I attempted to upgrade them!).

Any ideas, anyone?

Thanks in advance


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 08:10:05 PM
The fee that the wallet is requiring is dependent on the size of the transaction in kilobytes.  As you change the amount you are sending, you alter the number of inputs that are necessary to send that amount, and therefore the size (in bytes) of the transaction.

The Bitcoin-Qt wallet does a really poor job of creating a transaction that will allow you to send your full balance in a single transaction, especially when your wallet consists of a huge number of miniscule "dust" outputs.

I could probably calculate a transaction for you that would optimize the fee while allowing you to send the entire remaining amount (or the vast majority of it), but to do so I'd need a list of all the unspent outputs in your wallet.

You can generate a list of unspent outputs if you enter the following into the "Console" (found in the "Debug Window" of the "Help" menu).

Code:
listunspent


Title: Re: problem with bitcoin payment fees
Post by: RexBrocki on April 24, 2013, 08:17:18 PM
I am immensely grateful... but the only two things on my "help" menu are "about," and "about Bitcoin QT."


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 08:23:50 PM
I am immensely grateful... but the only two things on my "help" menu are "about," and "about Bitcoin QT."

Ah, I missed the part where you said you were currently running ver 0.6.3 beta.

I don't think the "Console" window was added until 0.7.1

There are still ways to get a list of unspent outputs, but it is a bit more difficult.


Title: Re: problem with bitcoin payment fees
Post by: DeathAndTaxes on April 24, 2013, 08:27:22 PM
There is no need to consolidate a wallet before upgrading the client.  It serves no purpose.  The issue is that the critical resource in the blockchain is space (not value).  Your wallet likely has a huge number of very small transactions (dust).  The wallet will pick inputs for the tx in an attempt to minimize fees.  As you send more and more that means the tx gets larger and larger (size not value).  Eventually you hit a point where all that is left is spammy garbage inputs (like hundreds of 0.00000001 BTC).

A couple thoughts:
a) there is no need, value, or reason to "consolidate" a wallet.
b) try to avoid engaging in "spammy" tx.  If you mine then make your payouts from the pool larger (i.e. get one 0.1 BTC payout a day instead of 10 0.01 BTC payouts). 
c) Add some more coins to your wallet.  Due to the way that Bitcoin works having more funds than you need to the wallet means on average you are going to pay less in fees (client can pick larger inputs, and smaller inputs become older reducing required fees).


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 08:57:09 PM
a) there is no need, value, or reason to "consolidate" a wallet.

Doesn't it reduce the UTXO, and improve the spendability of the funds that are in the wallet?

b) try to avoid engaging in "spammy" tx.  If you mine then make your payouts from the pool larger (i.e. get one 0.1 BTC payout a day instead of 10 0.01 BTC payouts).

And complain to merchants/services that pay in spammy transactions and refuse to patronize their service.


Title: Re: problem with bitcoin payment fees
Post by: DeathAndTaxes on April 24, 2013, 09:23:15 PM
Doesn't it reduce the UTXO, and improve the spendability of the funds that are in the wallet?

It does reduce the UXTO however the problem is current rules don't give an individual an incentive to do so.

As far as spendability.  Not really.  You are simply paying the fee now vs potentially paying a fee in the future.  Depending on other inputs, coin age etc it is possible the min mandatory fee will be lower or non-existent in the future.


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 09:43:44 PM
- snip -
As far as spendability.  Not really.  You are simply paying the fee now vs potentially paying a fee in the future.

If I have a wallet that has 20 outputs each valued at 0.1 BTC, I'd have to wait 10 days to spend any of them fee-less.  In the mean time, EVERY transaction I create will require a 0.0005 BTC fee.

So, If I wanted to send 5 transactions during that 10 days, I'd end up spending 0.0025 BTC in fees.  Meanwhile, due to the change from each of those transactions, I'd end up with several even smaller outputs that will require even longer before they are spendable. Meaning after the 10 days is up, I'd still have required fees.

Now, if I consolidated the 20 outputs, I could pay a single 0.0005 BTC fee, and end up with a single 1.9995 BTC output in my wallet.  About 12 hours later this output would be available to be spent without fees, and the resulting change would again be a large output (the difference between 1.9995 and the amount spent).  Assuming the amount spent was less than 0.9995 BTC, the change would also be spendable fee-less within a day.  You could spend around 0.1 BTC every day for 10 days on that single 0.0005 fee used for consolidation.




Title: Re: problem with bitcoin payment fees
Post by: alyssa85 on April 24, 2013, 09:59:18 PM

If I have a wallet that has 20 outputs each valued at 0.1 BTC, I'd have to wait 10 days to spend any of them fee-less.  In the mean time, EVERY transaction I create will require a 0.0005 BTC fee.


Does that mean that if you have a lot of small credits in your wallets ("dust" I think you called them!), you should wait ten days before doing anything? Why ten days - is that the time it takes for the small inputs to get confirmed by all the nodes in the network?

Sorry if this is a stupid question, but I'm new and I don't really understand the point of the fees at all.


Title: Re: problem with bitcoin payment fees
Post by: kingofmoon on April 24, 2013, 10:09:17 PM
I still don't understand why it cost more to SEND something if you have more transactions going IN to your wallet.
Why does the system care where I got the money from (as long as they are verified)?

if I want to send 1 BTC why does it matter if I accumulated my "wealth" by 5000 or 5 transactions? This hurt business that sell t-shirts over people selling gaming computers then, since they have more transactions with less money coming in.


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 10:19:12 PM
If I have a wallet that has 20 outputs each valued at 0.1 BTC, I'd have to wait 10 days to spend any of them fee-less.  In the mean time, EVERY transaction I create will require a 0.0005 BTC fee.
Does that mean that if you have a lot of small credits in your wallets ("dust" I think you called them!), you should wait ten days before doing anything? Why ten days - is that the time it takes for the small inputs to get confirmed by all the nodes in the network?

Sorry if this is a stupid question, but I'm new and I don't really understand the point of the fees at all.

There are a few conditions that trigger a fee requirement.

If a transaction is larger than 10 kilobytes, then you need a fee per kilobyte.

If any output of the transaction is less than 0.01 BTC then you need a fee.

If the "priority" of the transaction is too low, then you need a fee.

Assuming that your transaction is smaller than 10 kilobytes, and that all outputs are larger than 0.01 BTC, the calculated "priority" will determine if a fee is required.

Priority is determined by both the value and age of the inputs.  Generally one "bitcoin day" is enough to avoid a fee.

As such, 2 bitcoins aged a half day, or 4 bitcoins aged a forth of a day, or a half bitcoin aged 2 days, would all be enough to avoid the fee.

Since I used 0.1 BTC (one tenth of a bitcoin) in my example, as the value of the inputs, they'd need to age ten days to get a high enough priority.  Meanwhile after consolidating them, you'd have a single input valued at nearly 2 bitcoins, so it'd have a high enough priority in just over 12 hours.

If you have inputs valued at 0.00000001 BTC (frequently received from SatoshiDice), they'd have to age for 10,000,000 days before they could be individually spent without a fee.

If you add larger outputs to your wallet, they can be spent combined with the smaller outputs to arrive at a higher average priority.


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 10:23:39 PM
I still don't understand why it cost more to SEND something if you have more transactions going IN to your wallet.
Why does the system care where I got the money from (as long as they are verified)?

if I want to send 1 BTC why does it matter if I accumulated my "wealth" by 5000 or 5 transactions? This hurt business that sell t-shirts over people selling gaming computers then, since they have more transactions with less money coming in.

It only hurts if the amount being spent is so small as to be considered "spam" by the network.

The problem is that spending more outputs results in larger sized transactions (in terms of bytes).  Those bytes take up space in the blocks that the miners are creating, and there is a limited amount of space available in each block (currently 1 megabyte). So block space is valuable to the miner.  They total fees they can earn for a single block depends on the fees paid per byte of transaction size by those sending transactions.


Title: Re: problem with bitcoin payment fees
Post by: kingofmoon on April 24, 2013, 10:30:02 PM
I still don't understand why it cost more to SEND something if you have more transactions going IN to your wallet.
Why does the system care where I got the money from (as long as they are verified)?

if I want to send 1 BTC why does it matter if I accumulated my "wealth" by 5000 or 5 transactions? This hurt business that sell t-shirts over people selling gaming computers then, since they have more transactions with less money coming in.

It only hurts if the amount being spent is so small as to be considered "spam" by the network.


Amount being spent you say, is that spent by the people buying t-shirt or the t-shirt company?

Also you said;
"If you have inputs valued at 0.00000001 BTC (frequently received from SatoshiDice), they'd have to age for 10,000,000 days before they could be individually spent without a fee."

So for example;
 I have a few of those 0.00000<something> transactions is there any hope for me to ever be able to spend bitcoins without having to pay a few? Or are was my first day in bitcoin world with a lot of small transactions messing it up for the rest of my life?


Title: Re: problem with bitcoin payment fees
Post by: Birdy on April 24, 2013, 10:30:39 PM
I don't know if it's aviable for your old version, but I use coin control to be able to select what coins are sent.

https://bitcointalk.org/index.php?topic=144331.0

Quote
So for example;
 I have a few of those 0.00000<something> transactions is there any hope for me to ever be able to spend bitcoins without having to pay a few? Or are was my first day in bitcoin world with a lot of small transactions messing it up for the rest of my life?

You can bundle them up with bigger transaction using this coin control.
I'm still dust cleaning in my wallet whenever I have to send something xD


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 24, 2013, 10:43:22 PM
Amount being spent you say, is that spent by the people buying t-shirt or the t-shirt company?

Yes.  As I said, as long as the total size of a transaction is less than 10 kilobytes, and the value of every output is larger than 0.01 BTC, and the priority of the transaction is greater than the equivalent of 1 bitcoin day, the transaction can be attempted without fees at the moment.  It doesn't matter who's doing the spending, only that the "spam filter" fee requirements aren't exceeded. Fee requirements are likely to change in the future as the exchange rate increases (it has changed in the past).

On the other hand, as bitcoin gains popularity, the available space in a block will become more valuable.  As such, even if the "spam rules" don't require a fee, it may become nearly impossible to get a confirmation without a reasonable fee.  It's possible that by then there will be third-party services that will provide methods for transferring bitcoin value off-blockchain.

Also you said;
"If you have inputs valued at 0.00000001 BTC (frequently received from SatoshiDice), they'd have to age for 10,000,000 days before they could be individually spent without a fee."

So for example;
 I have a few of those 0.00000<something> transactions is there any hope for me to ever be able to spend bitcoins without having to pay a few? Or are was my first day in bitcoin world with a lot of small transactions messing it up for the rest of my life?

Well, as the exchange rate for bitcoins increases, the fee requirements are likely to be reduced.  In the meantime, you could create a backup of your current wallet (to recover in the future after the outputs have aged and the fee requirements are reduced), and start a new wallet.  You could also (as has already been mentioned by "DeathAndTaxes") send a single larger output to the wallet.  Over time, as the "dust" ages, the wallet may occasionally include it with the larger output to "consolidate" it.  Meanwhile the wallet will use the larger output for transactions and simply ignore the tiny ones.


Title: Re: problem with bitcoin payment fees
Post by: alyssa85 on April 24, 2013, 10:46:23 PM
birdy - I just had a look at your coin control thread (thanks to you and DannyHamilton  - you've cleared up a lot of things).

Is it possible to use the coin control thing on a wallet in blockchain.info?


Title: Re: problem with bitcoin payment fees
Post by: Birdy on April 24, 2013, 10:47:15 PM
birdy - I just had a look at your coin control thread (thanks to you and DannyHamilton  - you've cleared up a lot of things).

Is it possible to use the coin control thing on a wallet in blockchain.info?

I don't think so :/
It's an addition to the qt-client.


Title: Re: problem with bitcoin payment fees
Post by: 5120-01-518-6126 on April 25, 2013, 12:35:39 AM
Not trying to be flip here, but if I understand the end-game for deflationary currencies like Bitcoin, then the value of even small "denominations" will become so great as to be almost unspendable.  If that's true, then you probably won't use Bitcoins to buy T-shirts, instead, you'll use your Bitcoin holdings as collateral for the loan to buy a T-shirt manufacturing business.


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 25, 2013, 12:53:06 AM
Not trying to be flip here, but if I understand the end-game for deflationary currencies like Bitcoin, then the value of even small "denominations" will become so great as to be almost unspendable.  If that's true, then you probably won't use Bitcoins to buy T-shirts, instead, you'll use your Bitcoin holdings as collateral for the loan to buy a T-shirt manufacturing business.

Sure but what about your nanobitcoins?  How long do you suppose it would take for deflationary forces to affect the value of bitcoin to the point that nanobitcoins are too valuable to be spent for everyday purchases?


Title: Re: problem with bitcoin payment fees
Post by: 5120-01-518-6126 on April 25, 2013, 02:47:12 AM
Not trying to be flip here, but if I understand the end-game for deflationary currencies like Bitcoin, then the value of even small "denominations" will become so great as to be almost unspendable.  If that's true, then you probably won't use Bitcoins to buy T-shirts, instead, you'll use your Bitcoin holdings as collateral for the loan to buy a T-shirt manufacturing business.

Sure but what about your nanobitcoins?  How long do you suppose it would take for deflationary forces to affect the value of bitcoin to the point that nanobitcoins are too valuable to be spent for everyday purchases?

Ah, got it -- forgot how many digits there were after the decimal point.  So consolidaters will be balanced by spenders, and transaction fees will grow.  Thanks for the calibration.


Title: Re: problem with bitcoin payment fees
Post by: RexBrocki on April 25, 2013, 02:51:00 AM
Wow.  I post a simple question, look at the first few replies, go take a nap and then come back and see a plethora of knowledgeable replies on the topic from the bitcoin community.

As I said, wow.

This confirms me in the belief, formed over a year ago, that for some reason, bitcoin has sucked in some of the brightest people on this planet.

That having been said, however, now I REALLY think there's a bug in this wallet.  I was already aware (though not to the depth that many of the people replying to my post are, to be sure) of the age and "dust" issues... but that still doesn't explain why the fees my wallet is requesting change at every request, EVEN WHEN I'M NOT CHANGING ANYTHING ELSE.

Other data: there are only two transactions in this wallet younger than EIGHT MONTHS.  This was one of my first wallets, set up over a year ago, when I was first getting into bitcoins, and I was just trying to clean up and remove any coins from this old wallet before May 15th and shut off the POS laptop it occupies.

The two newest transaction are also over two weeks old, two referrals from Bitvisitor for 8 and 16 microbitcoins respectively... these are also the two smallest transactions in the wallet, as far as I am aware.  Every other transaction is at least seven and a half months older and up into the milli-bitcoin range or larger.

Thanks everyone for the cogent replies... and if anybody can figure out how the requested fees can jump around like a flea with an itch, pray continue.


Title: Re: problem with bitcoin payment fees
Post by: Birdy on April 25, 2013, 03:51:31 AM

Thanks everyone for the cogent replies... and if anybody can figure out how the requested fees can jump around like a flea with an itch, pray continue.

My guess is that the used coins for the transaction are selected randomly.
Usually you have to pay a size fee for every 5-6 transaction used, so if it selects 30 dust transactions...
The age of the coins isn't relevant to this fee.

There are two different fees, one is about the file size (0.0005 for every 5-6 transactions included),
the other one is about priority (fixed 0.0005).


Btw:
The formula for priority is
priority = ((BTC address balance*100000000) * number of confirmations (weighted over all coins) / size of transaction message in bytes)
A priority of 57.600.000 is needed to send without fees.
It will be years before you could send dust without fee without bundling it with bigger transactions.

This is mandatory in the qt-client, the fees aren't enforced by the Bitcoin system itself.
So it could be handled in another way by the online wallet.


Title: Re: problem with bitcoin payment fees
Post by: alyssa85 on April 27, 2013, 05:13:07 PM

Btw:
The formula for priority is
priority = ((BTC address balance*100000000) * number of confirmations (weighted over all coins) / size of transaction message in bytes)
A priority of 57.600.000 is needed to send without fees.
It will be years before you could send dust without fee without bundling it with bigger transactions.


Hi - I just checked on my blockchain wallet - the oldest transaction has over 900 confirmations. How high do the confirmations go? Does anyone have any idea?


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 27, 2013, 05:17:04 PM
- snip -
Hi - I just checked on my blockchain wallet - the oldest transaction has over 900 confirmations. How high do the confirmations go? Does anyone have any idea?

They don't stop.  Every time a new block is added to the blockchain (approximately every 10 minutes on average), the transaction is considered to have another "confirmation".  This will continue for as long as bitcoin exists.


Title: Re: problem with bitcoin payment fees
Post by: alyssa85 on April 29, 2013, 08:03:58 AM
OK - another question about inputs and outputs.

Say I have a wallet with 2 BTC in it, which is made up of 50inputs of  0.04BTC each. I want to send 1BTC to another wallet - am I right that this will be made up of 25 inputs, and the transaction size will be 25 x 200bytes = 5000 ?


Title: Re: problem with bitcoin payment fees
Post by: DannyHamilton on April 29, 2013, 02:05:45 PM
OK - another question about inputs and outputs.

Say I have a wallet with 2 BTC in it, which is made up of 50inputs of  0.04BTC each. I want to send 1BTC to another wallet - am I right that this will be made up of 25 inputs, and the transaction size will be 25 x 200bytes = 5000 ?

Yes, if every unspent output in your wallet was exactly 0.04 BTC, then a transaction to send 1 BTC would be at least 25 inputs.  Depending on the wallet program used to create the transaction there might be a preference programmed in to create "change".  This improves privacy a bit.  If a transaction only has a single output, then it becomes immediately obvious what address is being paid and how much is being sent.  If an address has 2 outputs, then it isn't as easy for someone to tell which is the "change" and which is the "payment".  If the wallet has a preference programmed in to create "change", then it might actually use something like 28 inputs, and create a second output for 0.12 BTC.


A transaction size is made up of more than just inputs, and inputs are typically more like 180 bytes each.

For the sake of the math, lets assume that your wallet creates a transaction with exactly 25 inputs and 1 output, here's the structure of such a transaction:

Code:
4 byte version number
1 byte input quantity
Then for each input:
Code:
32 byte transactionID
4 byte index
1 byte scriptSig length
1 byte signature length
variable length signature (perhaps typically approximately 72 bytes?)
1 byte public key length
65 byte public key
4 byte sequence number
(That's 108 bytes plus the signature per input, figure a typical input at 180 bytes)
Then:
Code:
1 byte output quantity
Then for each output:
Code:
8 byte output value
1 byte script length
1 byte OP_DUP script code
1 byte OP_HASH160 script code
1 byte code to push 20 bytes onto the script processing stack
20 byte bitcoin address to pay to
1 byte OP_EQUALVERIFY script code
1 byte OP_CHECKSIG script code
(That's 34 bytes per output)


So depending on the length of the signatures in your example transaction, it should be around:

4 + 1 + (180 X 25) + 1 + (34 X 1) = 4,540 bytes


Title: Re: problem with bitcoin payment fees
Post by: alyssa85 on April 29, 2013, 02:14:54 PM
DannyHamilton - you're a star! Thank you very much!