Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction fees and dust values #2

Open
jsalatas opened this issue Jun 15, 2019 · 7 comments
Open

Transaction fees and dust values #2

jsalatas opened this issue Jun 15, 2019 · 7 comments

Comments

@jsalatas
Copy link

TransactionOutput::getMinNonDustValue()

defines "the minimum value for this output to be considered "not dust"" as

(Transaction::REFERENCE_DEFAULT_MIN_TX_FEE * 3) * (33 + 148)

where (33 + 148) is the size of the transaction's output in bytes and requires an input of 148 bytes as seen at
TransactionOutput::getMinNonDustValue(Coin)

Faircoin's current blockchain parameters define a Transaction fee equal to 0.008 FAIR.

Question 1: Does it refer to Transaction::REFERENCE_DEFAULT_MIN_TX_FEE or to Transaction::DEFAULT_TX_FEE ???

The blockchain parameters also define a Dust threshold equal also to 0.008 FAIR which I guess refers to Transaction::MIN_NONDUST_OUTPUT. Right?

Question 2: I am not sure how is this connected to the TransactionOutput::getMinNonDustValue() above. In bitcoin branch Transaction::MIN_NONDUST_OUTPUT and the output of TransactionOutput::getMinNonDustValue() are about the same. In faircoin's branch I fail to see how are these related. :\

@jsalatas
Copy link
Author

ping? :)

@jsalatas
Copy link
Author

ping? :\

@jsalatas
Copy link
Author

last ping :)

@TonyFord
Copy link

Question 1:
REFERENCE_DEFAULT_MIN_TX_FEE means the minimum fee that will treat as fee in Bitcoin. If the fee is lower then it will treat equal as no fee.
DEFAULT_TX_FEE means the fee where the chance is high that the transaction will confirmed in a couple of blocks.

In FairCoin we don't have the fee competition. So both values are the same. But the reference to REFERENCE_DEFAULT_MIN_TX_FEE make more sense because in FairCoin higher fees will also accepted but lower fees not.

MIN_NONDUST_OUTPUT, here I have found a good explanation in the bitcoinj
https://github.com/bitcoinj/bitcoinj/blob/25f36872d5284ad2a1c4372972e38855de35798d/core/src/main/java/org/bitcoinj/core/TransactionOutput.java

In my opinion it is the same calculation as the fee. So I would remove the .multiply(3)
return getMinNonDustValue(Transaction.REFERENCE_DEFAULT_MIN_TX_FEE);
That means that the lowest NonDustValue is the same as the fee.

Question 2:
Transaction::MIN_NONDUST_OUTPUT is depreciated, see this commit in bitcoinj
bitcoinj@6035608#diff-25a7d8851e54b470509e6fc28323aa8b

https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/Transaction.java#L126

In my opinion the value should be ( minimum tx size * 0.008 / 1000 ) = 192 * 0.008 / 1000 = 153600satFAIR

I have used 192bytes in the calculation because I have found this size in the faircoin blockchain single tx.

@jsalatas
Copy link
Author

DEFAULT_TX_FEE means the fee where the chance is high that the transaction will confirmed in a couple of blocks.

So this doesn't apply to PoC algorithm. Right? As any transaction in the block is confirmed and there is no way to have a fork in the blockchain, because CVNs always need to agree before posting the block.

I have used 192bytes in the calculation because I have found this size in the faircoin blockchain single tx.

FYI: There are some clients that calculate different fees than others. I have posted in telegram some examples of such blocks in the past. So we may need to describe exactly how the fees should be calculated.

@TonyFord
Copy link

TonyFord commented May 21, 2020

I have found this in the faircoin sources.

https://github.com/faircoin/faircoin/blob/master/src/primitives/transaction.h#L138

size_t nSize = GetSerializeSize(SER_DISK,0)+148u;
return 3*minRelayTxFee.GetFee(nSize);

the GetFee method is defined here
https://github.com/faircoin/faircoin/blob/master/src/amount.cpp#L20

the GetSerializeSize here
https://github.com/faircoin/faircoin/blob/master/src/serialize.h

3*800000*(148 + 34)/1000=436800

This would be the same ratio as in bitcoin ( dust/fee 546/1000 )

@jsalatas
Copy link
Author

Nice! That might be something!

Thanks again! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants