Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: madmadmax on March 15, 2013, 03:23:48 AM



Title: Using proper fees
Post by: madmadmax on March 15, 2013, 03:23:48 AM
How do you calculate the optimal fee code wise? Also what is the purpose seeing that the majority of clients will not modify the worker to not include it in the block on purpose if it has zero fees?


Title: Re: Using proper fees
Post by: slimofftb on March 18, 2013, 12:12:03 AM

The fee is added to the payment amount. For example, if you are sending a 1.234 BTC payment and the client requires a 0.0005 BTC fee, then 1.2345 BTC will be subtracted from the wallet balance for the entire transaction and the address for where the payment was sent will receive a payment of 1.234 BTC.


Because the fee is related to the amount of data that makes up the transaction and not to the amount of Bitcoins being sent, the fee may seem extremely low (0.0005 BTC for a 1,000 BTC transfer) or unfairly high (0.004 BTC for a 0.02 BTC payment, or about 20%). If you are receiving tiny amounts (e.g. as small payments from a mining pool) then fees when sending will be higher than if your activity follows the pattern of conventional consumer or business transactions.

As of Bitcoin 0.5.3 the required fee will not be higher than 0.05 BTC. For most users there is usually no required fee at all. If a fee is required it will most commonly be 0.0005 BTC.

A transaction will be sent without fees if these conditions are met:

    It is smaller than 10 thousand bytes.
    All outputs are 0.01 BTC or larger.
    Its priority is large enough (see the Technical Info section below)

Otherwise, the reference implementation will round up the transaction size to the nearest thousand bytes and then add a fee of 0.0005 BTC per thousand bytes. Users may override the default 0.0005 BTC/kb fee setting, but cannot control transaction fees for each transaction. Bitcoin-Qt does prompt the user to accept the fee before the transaction is sent (they may cancel the transaction if they are not willing to pay the fee).

Note that a typical transaction is 500 bytes, so the typical transaction fee is 0.0005 BTC, regardless of the number of bitcoins sent.


I hope this helps you


Title: Re: Using proper fees
Post by: BookLover on March 18, 2013, 01:12:45 AM
A transaction can gain priority by having "aged" inputs.  I've sent small (<1 btc), aged, coins without a fee and they had the greatest priority of all the transactions in the block. :o  Just thought I should mention this because it seems to be a commonly overlooked fact. :-\


Title: Re: Using proper fees
Post by: madmadmax on March 18, 2013, 07:32:35 PM

The fee is added to the payment amount. For example, if you are sending a 1.234 BTC payment and the client requires a 0.0005 BTC fee, then 1.2345 BTC will be subtracted from the wallet balance for the entire transaction and the address for where the payment was sent will receive a payment of 1.234 BTC.


Because the fee is related to the amount of data that makes up the transaction and not to the amount of Bitcoins being sent, the fee may seem extremely low (0.0005 BTC for a 1,000 BTC transfer) or unfairly high (0.004 BTC for a 0.02 BTC payment, or about 20%). If you are receiving tiny amounts (e.g. as small payments from a mining pool) then fees when sending will be higher than if your activity follows the pattern of conventional consumer or business transactions.

As of Bitcoin 0.5.3 the required fee will not be higher than 0.05 BTC. For most users there is usually no required fee at all. If a fee is required it will most commonly be 0.0005 BTC.

A transaction will be sent without fees if these conditions are met:

    It is smaller than 10 thousand bytes.
    All outputs are 0.01 BTC or larger.
    Its priority is large enough (see the Technical Info section below)

Otherwise, the reference implementation will round up the transaction size to the nearest thousand bytes and then add a fee of 0.0005 BTC per thousand bytes. Users may override the default 0.0005 BTC/kb fee setting, but cannot control transaction fees for each transaction. Bitcoin-Qt does prompt the user to accept the fee before the transaction is sent (they may cancel the transaction if they are not willing to pay the fee).

Note that a typical transaction is 500 bytes, so the typical transaction fee is 0.0005 BTC, regardless of the number of bitcoins sent.


I hope this helps you

Thank you for your input, I really do appreciate it very much, sent you a tip.

Are there any functions within the bitcoin daemon that would sum all those processes up into a line of code? If not how would the psuedocode for such a calculation look?


Title: Re: Using proper fees
Post by: slimofftb on March 18, 2013, 09:07:41 PM
the way i did it is i assumed each transaction is going to have a fee of 0.005

like this

<?php
require_once 'jsonRPCClient.php';
  // Replace with the username and password you set in bitcoin.conf
  $bitcoin = new jsonRPCClient('http:/xxxx:xxxx@xx.xx.xx.xx:8332/');
  print($bitcoin->settxfee(0.005));
 ?>



Title: Re: Using proper fees
Post by: slimofftb on March 18, 2013, 10:08:42 PM

The fee is added to the payment amount. For example, if you are sending a 1.234 BTC payment and the client requires a 0.0005 BTC fee, then 1.2345 BTC will be subtracted from the wallet balance for the entire transaction and the address for where the payment was sent will receive a payment of 1.234 BTC.


Because the fee is related to the amount of data that makes up the transaction and not to the amount of Bitcoins being sent, the fee may seem extremely low (0.0005 BTC for a 1,000 BTC transfer) or unfairly high (0.004 BTC for a 0.02 BTC payment, or about 20%). If you are receiving tiny amounts (e.g. as small payments from a mining pool) then fees when sending will be higher than if your activity follows the pattern of conventional consumer or business transactions.

As of Bitcoin 0.5.3 the required fee will not be higher than 0.05 BTC. For most users there is usually no required fee at all. If a fee is required it will most commonly be 0.0005 BTC.

A transaction will be sent without fees if these conditions are met:

    It is smaller than 10 thousand bytes.
    All outputs are 0.01 BTC or larger.
    Its priority is large enough (see the Technical Info section below)

Otherwise, the reference implementation will round up the transaction size to the nearest thousand bytes and then add a fee of 0.0005 BTC per thousand bytes. Users may override the default 0.0005 BTC/kb fee setting, but cannot control transaction fees for each transaction. Bitcoin-Qt does prompt the user to accept the fee before the transaction is sent (they may cancel the transaction if they are not willing to pay the fee).

Note that a typical transaction is 500 bytes, so the typical transaction fee is 0.0005 BTC, regardless of the number of bitcoins sent.


I hope this helps you

Thank you for your input, I really do appreciate it very much, sent you a tip.

Are there any functions within the bitcoin daemon that would sum all those processes up into a line of code? If not how would the psuedocode for such a calculation look?

Thank you for the tip too btw


Title: Re: Using proper fees
Post by: madmadmax on March 18, 2013, 11:18:02 PM
the way i did it is i assumed each transaction is going to have a fee of 0.005

like this

<?php
require_once 'jsonRPCClient.php';
  // Replace with the username and password you set in bitcoin.conf
  $bitcoin = new jsonRPCClient('http:/xxxx:xxxx@xx.xx.xx.xx:8332/');
  print($bitcoin->settxfee(0.005));
 ?>



I do know how to set a flat fee however there are instances where you could potentially save bitcoins by paying the absolutely lowest tax possible.


Title: Re: Using proper fees
Post by: slimofftb on March 19, 2013, 08:53:24 AM
maybe by validating IF the transaction is a certain size than + specific fee....

just trying to give some basic ideas.


Title: Re: Using proper fees
Post by: madmadmax on March 19, 2013, 04:21:13 PM
maybe by validating IF the transaction is a certain size than + specific fee....

just trying to give some basic ideas.

Psuedocode? What API command estimates the transaction size?


Title: Re: Using proper fees
Post by: madmadmax on March 24, 2013, 03:52:59 PM
bump


Title: Re: Using proper fees
Post by: madmadmax on March 28, 2013, 11:37:37 PM
Bumpidibumpidump