Bitcoin Forum
May 23, 2019, 12:23:00 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Transaction dust (or how to calculate transaction fees?)  (Read 1783 times)
sr_gi
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
November 23, 2015, 03:38:35 PM
 #1

Hi there,

I'm trying to figure out how exactly the fees related to the transaction dust work. I'm trying to test some code related to small payments (or maybe even micro-payments) in the testnet and I'm getting a bit stuck.

For what I could find in the source code:

Quote
 // "Dust" is defined in terms of CTransaction::minRelayTxFee,
  // which has units satoshis-per-kilobyte.
  // If you'd pay more than 1/3 in fees
  // to spend something, then we consider it dust.
  // A typical txout is 34 bytes big, and will
  // need a CTxIn of at least 148 bytes to spend:
  // so dust is a txout less than 546 satoshis
  // with default minRelayTxFee.

I've also read from stackexchange that :

Quote
Sending less than 0.01 BTC to any recipient — The network considers these small outputs to be “dust,” and discourages them by requiring a fee.

But I couldn't find how those fees are applied. It mean that for each input smaller than 0.001 BTC a minimum fee should be included? So for example a transaction with 3 inputs (two of them with less than 0.001 BTC) and two outputs will need 3*0.00001 BTC as fee? (One for each input below 0.001 and another one as BTC/kb payment?)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Pattart
Hero Member
*****
Offline Offline

Activity: 1190
Merit: 500



View Profile
November 23, 2015, 03:54:04 PM
 #2

To calculate the dust, consider an the size of the output, and the size of the corresponding input to spend it. In most cases, the output is 34 bytes and the input that spends it will be 148 bytes. Add those together and you get 182 bytes. The minrelaytxfee in the latest version is 0.00005 BTC/kb. So that means it is 0.00000005 BTC/byte. Multiply that by the number of bytes required to spend the output (182). You will get 0.0000091. Multiply that by 3 and you get the current dust threshold of 0.0000273 BTC.

This means that in order to spend 0.0000273 BTC or lower, you will be paying one third or more of that amount in fees.
Miiike
Legendary
*
Online Online

Activity: 1344
Merit: 1040



View Profile
November 23, 2015, 05:14:15 PM
 #3

Glad there is someone talking about transaction dust, I have a question about it but I didn't want to wake an old sleeping thread. My question is, I heard that Xapo gives a free transaction fee services. Does this means I'll be completely free from transaction dust that (they say will always) follows the faucet activity?

Pattart
Hero Member
*****
Offline Offline

Activity: 1190
Merit: 500



View Profile
November 23, 2015, 05:19:05 PM
 #4

Glad there is someone talking about transaction dust, I have a question about it but I didn't want to wake an old sleeping thread. My question is, I heard that Xapo gives a free transaction fee services. Does this means I'll be completely free from transaction dust that (they say will always) follows the faucet activity?
No. Xapo is paying the fee for you. The fee is separate from the dust. The dust is determined by the minimum fee that nodes are willing to relay.
Miiike
Legendary
*
Online Online

Activity: 1344
Merit: 1040



View Profile
November 23, 2015, 05:32:50 PM
 #5

Glad there is someone talking about transaction dust, I have a question about it but I didn't want to wake an old sleeping thread. My question is, I heard that Xapo gives a free transaction fee services. Does this means I'll be completely free from transaction dust that (they say will always) follows the faucet activity?
No. Xapo is paying the fee for you. The fee is separate from the dust. The dust is determined by the minimum fee that nodes are willing to relay.

Oh god, now it's getting even more complicated.. Could you suggest me a thread explaining the difference between fee and the dust? Or better, can you help explain it to me in an easy way?

Pattart
Hero Member
*****
Offline Offline

Activity: 1190
Merit: 500



View Profile
November 23, 2015, 06:49:26 PM
 #6

Glad there is someone talking about transaction dust, I have a question about it but I didn't want to wake an old sleeping thread. My question is, I heard that Xapo gives a free transaction fee services. Does this means I'll be completely free from transaction dust that (they say will always) follows the faucet activity?
No. Xapo is paying the fee for you. The fee is separate from the dust. The dust is determined by the minimum fee that nodes are willing to relay.

Oh god, now it's getting even more complicated.. Could you suggest me a thread explaining the difference between fee and the dust? Or better, can you help explain it to me in an easy way?
Basically the fee is a bribe to miners to include your transaction. Generally the higher your transaction fee is, the more likely your transaction will get confirmed sooner. The fee is typically based on the size of the transaction. Dust is an output that is so small that spending it would require a fee that is 1/3 or more of the output itself. The dust threshold is determined by a minimum fee that nodes are willing to relay. The current default is 0.00005 BTC/kb. This makes the current dust threshold to be 2730 satoshis, the calculation is explained earlier.
odolvlobo
Legendary
*
Offline Offline

Activity: 2506
Merit: 1314



View Profile
November 23, 2015, 07:39:36 PM
 #7

Hi there,

I'm trying to figure out how exactly the fees related to the transaction dust work. I'm trying to test some code related to small payments (or maybe even micro-payments) in the testnet and I'm getting a bit stuck.

For what I could find in the source code:

Quote
 // "Dust" is defined in terms of CTransaction::minRelayTxFee,
  // which has units satoshis-per-kilobyte.
  // If you'd pay more than 1/3 in fees
  // to spend something, then we consider it dust.
  // A typical txout is 34 bytes big, and will
  // need a CTxIn of at least 148 bytes to spend:
  // so dust is a txout less than 546 satoshis
  // with default minRelayTxFee.

I've also read from stackexchange that :

Quote
Sending less than 0.01 BTC to any recipient — The network considers these small outputs to be “dust,” and discourages them by requiring a fee.

But I couldn't find how those fees are applied. It mean that for each input smaller than 0.001 BTC a minimum fee should be included? So for example a transaction with 3 inputs (two of them with less than 0.001 BTC) and two outputs will need 3*0.00001 BTC as fee? (One for each input below 0.001 and another one as BTC/kb payment?)

You are making it more complicated than it needs to be. The fee is applied to the size of the entire transaction.

The comments in the source about the size of inputs and outputs are referring to determining the minimum size of a transaction.

The "dust" in the stackexchange quote is informally referring to any small amount as "dust". The rule that it is referring to requires any transaction that includes an output of less than 0.01 BTC to pay the minimum fee.

This page might be helpful: https://en.bitcoin.it/wiki/Transaction_fees

Buy bitcoins with cash from somebody near you: LocalBitcoins
Buy stuff on Amazon at a discount with bitcoins or convert Amazon points to bitcoins: Purse.io
Join an anti-signature campaign: Click ignore on the members of signature campaigns.
Miiike
Legendary
*
Online Online

Activity: 1344
Merit: 1040



View Profile
November 23, 2015, 08:10:10 PM
 #8

Glad there is someone talking about transaction dust, I have a question about it but I didn't want to wake an old sleeping thread. My question is, I heard that Xapo gives a free transaction fee services. Does this means I'll be completely free from transaction dust that (they say will always) follows the faucet activity?
No. Xapo is paying the fee for you. The fee is separate from the dust. The dust is determined by the minimum fee that nodes are willing to relay.

Oh god, now it's getting even more complicated.. Could you suggest me a thread explaining the difference between fee and the dust? Or better, can you help explain it to me in an easy way?
Basically the fee is a bribe to miners to include your transaction. Generally the higher your transaction fee is, the more likely your transaction will get confirmed sooner. The fee is typically based on the size of the transaction. Dust is an output that is so small that spending it would require a fee that is 1/3 or more of the output itself. The dust threshold is determined by a minimum fee that nodes are willing to relay. The current default is 0.00005 BTC/kb. This makes the current dust threshold to be 2730 satoshis, the calculation is explained earlier.

Which means as long as i collect (we're talking from faucet) above 2730 sat, I won't get any dust?

shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1484
Merit: 1308


No I dont escrow anymore.


View Profile WWW
November 23, 2015, 08:14:01 PM
 #9

To calculate the dust, consider an the size of the output, and the size of the corresponding input to spend it. In most cases, the output is 34 bytes and the input that spends it will be 148 bytes. Add those together and you get 182 bytes. The minrelaytxfee in the latest version is 0.00005 BTC/kb. So that means it is 0.00000005 BTC/byte. Multiply that by the number of bytes required to spend the output (182). You will get 0.0000091. Multiply that by 3 and you get the current dust threshold of 0.0000273 BTC.

This means that in order to spend 0.0000273 BTC or lower, you will be paying one third or more of that amount in fees.

Keep in mind though that each node can modify minrelaytxfee and thus can have a different understanding of dust.

E.g. would a node set the setting to 0.00002 BTC/kb, dust would be 1092 satoshi.
sr_gi
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
November 23, 2015, 09:15:51 PM
 #10

To calculate the dust, consider an the size of the output, and the size of the corresponding input to spend it. In most cases, the output is 34 bytes and the input that spends it will be 148 bytes. Add those together and you get 182 bytes. The minrelaytxfee in the latest version is 0.00005 BTC/kb. So that means it is 0.00000005 BTC/byte. Multiply that by the number of bytes required to spend the output (182). You will get 0.0000091. Multiply that by 3 and you get the current dust threshold of 0.0000273 BTC.

This means that in order to spend 0.0000273 BTC or lower, you will be paying one third or more of that amount in fees.

So if I get it right:

  • In a transaction with 1 input and 1 output the required fee will be 910 Satoshi.
  • And if it have 2 inputs and 1 output, it will be 1650 Satoshi.
 

But what will happen in both cases if the inputs are below the transaction dust threshold, how big should be the fee in order to ensure that the transaction will be relayed?
Pattart
Hero Member
*****
Offline Offline

Activity: 1190
Merit: 500



View Profile
November 23, 2015, 10:15:29 PM
 #11

Which means as long as i collect (we're talking from faucet) above 2730 sat, I won't get any dust?
No. What you collect from the faucet become inputs for one of your transactions. You create transactions which have outputs. The inputs don't matter, what matters is that your outputs are above the dust threshold.

To calculate the dust, consider an the size of the output, and the size of the corresponding input to spend it. In most cases, the output is 34 bytes and the input that spends it will be 148 bytes. Add those together and you get 182 bytes. The minrelaytxfee in the latest version is 0.00005 BTC/kb. So that means it is 0.00000005 BTC/byte. Multiply that by the number of bytes required to spend the output (182). You will get 0.0000091. Multiply that by 3 and you get the current dust threshold of 0.0000273 BTC.

This means that in order to spend 0.0000273 BTC or lower, you will be paying one third or more of that amount in fees.

So if I get it right:

  • In a transaction with 1 input and 1 output the required fee will be 910 Satoshi.
  • And if it have 2 inputs and 1 output, it will be 1650 Satoshi.
 

But what will happen in both cases if the inputs are below the transaction dust threshold, how big should be the fee in order to ensure that the transaction will be relayed?
No, the transaction has a bunch of other data that also increases its size. The size that we are talking about here are specifically the bytes for an output and its corresponding input in the next transaction. It does not matter what the inputs of a transaction are, just that the size in bytes of the output and the corresponding input that spends it. In most cases this will be 182 bytes.

It does not matter that the inputs are dust, just that the outputs are dust. If the inputs are dust, then you will probably be spending more on fees than you will be getting in outputs.
sr_gi
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
November 24, 2015, 11:51:14 AM
 #12

Alright. Thank you so much!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!