Author

Topic: Transaction fee logic (Read 2120 times)

sr. member
Activity: 476
Merit: 250
Tangible Cryptography LLC
September 13, 2012, 08:51:04 AM
#13
Quote
That's why I think coin age should not be a reason to pay a fee. The whole blockchain would be a lot more efficient, if people had their wallet filled with new big coins instead of a lot of small old coins.
This might be important when pruning works..

Remember these fees have nothing to do with making revenue for miners.  Optional fees paid to gain priority access to blocks will support miners.  These fees are designed to protect the network.  Coinage is very important to prevent spam and denial of service attacks.  Without a coin age check one could take 100 BTC turn it into 10,000 0.01 BTC tx and then use those outputs to produce another 10,000 tx.  Essentially adding 10,000 tx worth of spam to every block into perpetuity for a token cost.

By basing the SPAM PREVENT fees (which is what the mandatory fees are, nothing more) based on coin-age the attacker is limited in the amount of "free" spam they can produce even with a relatively large amount of funds.
kjj
legendary
Activity: 1302
Merit: 1025
September 13, 2012, 07:20:34 AM
#12
A wallet with a single unspent output is certainly not optimal.

It doesn't take that much coinage to be considered high priority.

Take a user with 20 BTC.  Lets assume it is all in a single output and old enough to avoid low priority fee.
He spends 8 BTC gets 12 BTC back as change.  He now has to wait ~24 BTC hours or 2 hours before he can make a second tx without fee.

Compare that to a wallet same 20 BTC but in two 10 BTC unpsent outputs.  He can spend 8 BTC using one output and then seconds or minutes make a 2nd tx of up to 12 BTC without pay a fee.

Yes, that's what I pointed out; because of coin age priority, one coin is not optimal (unless you got over 144 BTC in your wallet)

That's why I think coin age should not be a reason to pay a fee. The whole blockchain would be a lot more efficient, if people had their wallet filled with new big coins instead of a lot of small old coins.
This might be important when pruning works..

Once pruning comes around, miners will probably adjust their priority schemes to prefer transactions that have more inputs than outputs.

My wallet is full of smallish transactions from p2pool.  I'm working on a script to use the raw transaction API to sweep gobs of those into larger single transactions.  Getting the balance right is tricky.
sr. member
Activity: 477
Merit: 500
September 13, 2012, 06:20:05 AM
#11
A wallet with a single unspent output is certainly not optimal.

It doesn't take that much coinage to be considered high priority.

Take a user with 20 BTC.  Lets assume it is all in a single output and old enough to avoid low priority fee.
He spends 8 BTC gets 12 BTC back as change.  He now has to wait ~24 BTC hours or 2 hours before he can make a second tx without fee.

Compare that to a wallet same 20 BTC but in two 10 BTC unpsent outputs.  He can spend 8 BTC using one output and then seconds or minutes make a 2nd tx of up to 12 BTC without pay a fee.

Yes, that's what I pointed out; because of coin age priority, one coin is not optimal (unless you got over 144 BTC in your wallet)

That's why I think coin age should not be a reason to pay a fee. The whole blockchain would be a lot more efficient, if people had their wallet filled with new big coins instead of a lot of small old coins.
This might be important when pruning works..
donator
Activity: 1218
Merit: 1079
Gerald Davis
September 13, 2012, 01:48:14 AM
#10
A wallet with a single unspent output is certainly not optimal.

It doesn't take that much coinage to be considered high priority.

Take a user with 20 BTC.  Lets assume it is all in a single output and old enough to avoid low priority fee.
He spends 8 BTC gets 12 BTC back as change.  He now has to wait ~24 BTC hours or 2 hours before he can make a second tx without fee.

Compare that to a wallet same 20 BTC but in two 10 BTC unpsent outputs.  He can spend 8 BTC using one output and then seconds or minutes make a 2nd tx of up to 12 BTC without pay a fee.
sr. member
Activity: 477
Merit: 500
September 13, 2012, 01:25:27 AM
#9
How about the payment coin optimization; quick (not very throughtful) peek at the code reveals it tries to first pay with one coin and then some optimization for paying with more than one coins. AFAIK,it is optimized for the current, ongoing payment.
Maybe it should be optimized for future payments, ie so that the end result is as good wallet as possible; not too small coins (which are expensive to spend) and the coin size as variable as possible.
Ie, woudn't optimal wallet be such that there is coins of different sizes, every coin size double the smaller one. Fex. 1BTC,2BTC,4BTC, 8BTC etc.
Or at least try to make the wallet so that future payments could be most likely to be payed with 2 input coins.

The coin selection is certainly non-optimal.  Part of the difficulty is optimal is highly subjective and variable depending on the user.    Still a "better" (albeit not optimal) algorithm could probably be used.  Honestly I don't really see it as a priority for current developers.  There are much more important changes to the client and protocol.   It is open source.  You could make improved coin selection your contribution.

Quote
In order for a transaction to be free, three conditions must be met:

--Transaction is less than 3.5 kB (approx)
--Transaction does not have any dust outputs (<0.01 BTC)
--Transaction inputs have priority-sum greater than 1 bitcoin-day-per-250-bytes

If the transaction cannot be free, then use the folllowing fee:
--If transaction is less than 3.5 kB, use fee 0.0005 BTC
--Otherwise, use (0.0005 * roundup(numkB))

There are more fees required to get it into the next block, if there's already a lot of transactions being included in the next block.  But this fee will always get it included in one of the next blocks.  So far, I haven't experienced any users (or myself) getting coins stuck in Armory.  

Well, based on this, the optimal wallet is One Big Old Fat Coin ;-) And every payment can be (and should be) used  to defragment the wallet...

But the problem is that after every transaction, you get change, which is a brand new coin.. Without the coin age priorization, one should allways use the whole wallet for every payment, as long as it fits to 3.5 kb limit. If it does not, use as many of the biggest coins as possible.
For the long run, this would be good also for the block chain. When the pruning comes to work, the coins would be more on the new blocks and they would be bigger.

Edit: this princible is ok, but formula sucks. Must rethink it..
But sinze there is coin age, the wallet should ask the user how many payments one makes per day and then collect (by payments) as many big old coins as she/he gives as an answer divided by 120 and multiplied by wallet coins. So, if your wallet size is 120 BTC or more, you can keep them in one coin.
sr. member
Activity: 476
Merit: 250
Tangible Cryptography LLC
September 11, 2012, 03:32:09 PM
#8
Old coins are preferred over new coins because transaction spammers spend coins over-and-over again quickly to try to flood the network with transactions.

Unintentional transaction spammers (like people playing SatoshiDice over and over) accidentally do the same thing, so their transactions are given low priority and can take a long time to get confirmed.

Maybe think of it this way:

+ Transaction fees are to pay miners to include your transactions.
+ Transaction priority is used to "pay" for the network bandwith used by free transactions (note that any node relaying or listening for transactions pays the cost of every extra transaction).



Well, that makes sense, thanks for the explanation (maybe there is FAQ somewhere?).

How about the payment coin optimization; quick (not very throughtful) peek at the code reveals it tries to first pay with one coin and then some optimization for paying with more than one coins. AFAIK,it is optimized for the current, ongoing payment.
Maybe it should be optimized for future payments, ie so that the end result is as good wallet as possible; not too small coins (which are expensive to spend) and the coin size as variable as possible.
Ie, woudn't optimal wallet be such that there is coins of different sizes, every coin size double the smaller one. Fex. 1BTC,2BTC,4BTC, 8BTC etc.
Or at least try to make the wallet so that future payments could be most likely to be payed with 2 input coins.

The coin selection is certainly non-optimal.  Part of the difficulty is optimal is highly subjective and variable depending on the user.    Still a "better" (albeit not optimal) algorithm could probably be used.  Honestly I don't really see it as a priority for current developers.  There are much more important changes to the client and protocol.   It is open source.  You could make improved coin selection your contribution.
sr. member
Activity: 477
Merit: 500
September 10, 2012, 01:57:32 AM
#7
Old coins are preferred over new coins because transaction spammers spend coins over-and-over again quickly to try to flood the network with transactions.

Unintentional transaction spammers (like people playing SatoshiDice over and over) accidentally do the same thing, so their transactions are given low priority and can take a long time to get confirmed.


However, this causes some costs for services which are for example directly forwarding customer's payment to some other address. I was thinking of one; ebook publisher/shop, where every single sold book price would go directly to the author's wallet. The server would need no coins online-> nothing to steal ;-)

Well, the fee is small, but..

Maybe this costs could be connetced only to coins, which are new even counted a couple or more blocks backwards?
sr. member
Activity: 477
Merit: 500
September 09, 2012, 01:33:40 PM
#6
Old coins are preferred over new coins because transaction spammers spend coins over-and-over again quickly to try to flood the network with transactions.

Unintentional transaction spammers (like people playing SatoshiDice over and over) accidentally do the same thing, so their transactions are given low priority and can take a long time to get confirmed.

Maybe think of it this way:

+ Transaction fees are to pay miners to include your transactions.
+ Transaction priority is used to "pay" for the network bandwith used by free transactions (note that any node relaying or listening for transactions pays the cost of every extra transaction).



Well, that makes sense, thanks for the explanation (maybe there is FAQ somewhere?).

How about the payment coin optimization; quick (not very throughtful) peek at the code reveals it tries to first pay with one coin and then some optimization for paying with more than one coins. AFAIK,it is optimized for the current, ongoing payment.
Maybe it should be optimized for future payments, ie so that the end result is as good wallet as possible; not too small coins (which are expensive to spend) and the coin size as variable as possible.
Ie, woudn't optimal wallet be such that there is coins of different sizes, every coin size double the smaller one. Fex. 1BTC,2BTC,4BTC, 8BTC etc.
Or at least try to make the wallet so that future payments could be most likely to be payed with 2 input coins.
legendary
Activity: 1652
Merit: 2216
Chief Scientist
September 09, 2012, 12:03:09 PM
#5
Old coins are preferred over new coins because transaction spammers spend coins over-and-over again quickly to try to flood the network with transactions.

Unintentional transaction spammers (like people playing SatoshiDice over and over) accidentally do the same thing, so their transactions are given low priority and can take a long time to get confirmed.

Maybe think of it this way:

+ Transaction fees are to pay miners to include your transactions.
+ Transaction priority is used to "pay" for the network bandwith used by free transactions (note that any node relaying or listening for transactions pays the cost of every extra transaction).

sr. member
Activity: 477
Merit: 500
September 09, 2012, 11:10:04 AM
#4
And please, compare these transactions. The fee for the first is no way reasonable, even if new coins are used:
--------------------
1DTUC4YLY1kbZma5qQ3jJXhqwDXtanStg1 (6.75469894 BTC - Output)
 ->1GfuGkYHCmvhkVL9ce2Brx5PjJxXzcfKCE - (Unspent) 0.75419894 BTC
 ->17fqpvb55TZ8hC1kLtkVtS6P3BzjQu6vR9 - (Spent) 6 BTC

Size    226 (bytes)
Total Input    6.75469894 BTC
Total Output    6.75419894 BTC
Fees    0.0005 BTC
Estimated BTC Transacted    0.75419894 BTC
-----------------------------------
1ELiqQQ7k2CbZFussYdBmZweSszebnShNL (0.50120203 BTC - Output)
1MDVCXeKNK3ntBszPfyL8hooHXJ2fWhtbh (1.45258315 BTC - Output)
1ERfdiQuqJFzPP6FDBcxTfcYRjcr3vaoBs (0.15874059 BTC - Output)

-> 1PCbi3LuSnYdQ2v9xoCbo8ReUdHQjM4X6r - (Unspent) 0.11252577 BTC
-> 1GKL7UpWQEU2tVCzf1bR3KuvZVeZ5NG2Am - (Unspent) 2 BTC
Size    520 (bytes)
Total Input    2.11252577 BTC
Total Output    2.11252577 BTC
Fees    0 BTC
Estimated BTC Transacted    2 BTC
-----------------------------------------------
sr. member
Activity: 477
Merit: 500
September 09, 2012, 11:04:48 AM
#3
I described it quite explicitly in this post:


https://bitcointalksearch.org/topic/m.1168268

Quote
In order for a transaction to be free, three conditions must be met:

--Transaction is less than 3.5 kB (approx)
--Transaction does not have any dust outputs (<0.01 BTC)
--Transaction inputs have priority-sum greater than 1 bitcoin-day-per-250-bytes

If the transaction cannot be free, then use the folllowing fee:
--If transaction is less than 3.5 kB, use fee 0.0005 BTC
--Otherwise, use (0.0005 * roundup(numkB))

There are more fees required to get it into the next block, if there's already a lot of transactions being included in the next block.  But this fee will always get it included in one of the next blocks.  So far, I haven't experienced any users (or myself) getting coins stuck in Armory.  

Oh, it must be the transaction priority. So old coins are preferred over new ones. I cannot see how new coins increases the transaction cost compared to old coins?
- I can see no increase in miner's resource usage (new vs old coins)
- is it to clean the old coins from the blockchain to newer blocks? Then the algorithm should be different: transactions with very old coins should be just free. Now optimized clients just use enought old coins to get free transacitions (1 day!)
- Is it because new coins are 'not-so-verified' and there is greter possibility they will cause the transaction to fail? Then it should not be sum of the coins, but just the latest coins should be counted, because the whole transaction is failed, if one of the coins appears to be invalid. And I think the risk * harm count would be very low.
legendary
Activity: 1428
Merit: 1093
Core Armory Developer
September 09, 2012, 09:46:18 AM
#2
I described it quite explicitly in this post:


https://bitcointalksearch.org/topic/m.1168268

Quote
In order for a transaction to be free, three conditions must be met:

--Transaction is less than 3.5 kB (approx)
--Transaction does not have any dust outputs (<0.01 BTC)
--Transaction inputs have priority-sum greater than 1 bitcoin-day-per-250-bytes

If the transaction cannot be free, then use the folllowing fee:
--If transaction is less than 3.5 kB, use fee 0.0005 BTC
--Otherwise, use (0.0005 * roundup(numkB))

There are more fees required to get it into the next block, if there's already a lot of transactions being included in the next block.  But this fee will always get it included in one of the next blocks.  So far, I haven't experienced any users (or myself) getting coins stuck in Armory.  
sr. member
Activity: 477
Merit: 500
September 09, 2012, 08:51:09 AM
#1
Compare these two transactions:

http://blockchain.info/tx-index/19470941/990bdf89aa2c9929397815024928749371d3f95d7024e6910c0c39599a366efa

and

http://blockchain.info/tx-index/19472730/5a21c267dfcb110498a5792ca2ad5176fef55e69d3cf365273725feb5f1e9e36

Both are generated with the standard bitcoin client. Why the smaller one needed a transaction fee, but the bigger one did not?

What is the logic on this? It does not seem to follow the rules on https://en.bitcoin.it/wiki/Transaction_fees

Based on that, neither of the example transactions would need a fee.

Btw, almost every transaction has 2 outputs; to minimize fragmentation, should the payment be constructed from 2 or more inputs, if possible? Might have a big effect when the pruning is working..

Edit :bitcoin client version: v0.7.0rc2-19-g31fac11-beta
Jump to: