OutCast3k / coinbin

Javascript Bitcoin Wallet. Supports Multisig, Stealth, HD, SegWit, Bech32, Time Locked Addresses, RBF and more!
https://coinb.in/
MIT License
906 stars 621 forks source link

Predictions on the /#fees page don't take transaction time into account #151

Open lunarovic opened 6 years ago

lunarovic commented 6 years ago

The premise

This page will give you a guide on the lowest fee to use to get your transaction included within the next few blocks. It works by predicting the size of a transaction and comparing it to another transaction in a recent block to determine an appropriate fee.

The result

Blockchain Data This is based on us comparing your transaction against a very recent transaction found in a very recent block

Block Height: 511145 Block #: 0000000000000000002d54d98972d0e2525ac5bea8642bfd61426b6ef369d0cb Block Time: 1519729339 27/02/2018 11:02:19 Transaction ID: 2e4e610cded4d017a7f653d244c140e411ba9c42e289e53dc5f823e6ce52bf15 Transaction Size: 225 bytes Transaction Fee: 0.00000227 Satoshi per Byte: 1

Based on your data and this recently mined transaction we recommend a fee of 0.00000226 BTC to get it into the next few blocks

Examination

The transaction on which the prediction was based got into a block 24 hours later (158 blocks). Let's take a look at this transaction on blockchain.info and on the left side we can see:

Received Time: 2018-02-26 11:06:15 Included In Blocks: 511145 ( 2018-02-27 11:02:19 + 1,436 minutes )

Conclusion

This is not an exception, now as I write this sentence, this is the TX which has been used for the prediction (19 hours). But sometimes I see a TX which is confirmed just a few minutes after being sent. So it seems that the prediction doesn't at all take into account transaction age and just looks for the lowest confirmed transaction fees, regardless of when the transaction has been first seen on the network.

By the way, I suggest switching the TX link from BlockCypher to Blockchain.info, since the former doesn't seem to have the transaction time in its TX page, so it's not as informative to users.

dabura667 commented 6 years ago

NACK blockchain.info

Not only have they lost hundreds of bitcoins across multiple bugs most of which were easy to catch with simple peer review...

But there have been many cases in the past where their block explorer was caught NOT EVEN VERIFYING THE TRANSACTION (someone signed a transaction for satoshi’s bitcoins and the signature was invalid, but since the culprit sent it directly to blockchain.info everyone freaked out.

If I made a website that had to link to outside sources for blockchain info, it would ironically not be blockchain dot info. lol

genus1 commented 6 years ago

I recommend using https://bitcoinfees.earn.com/api/v1/fees/recommended which returns JSON as examplt { "fastestFee": 40, "halfHourFee": 20, "hourFee": 10 }. I have run my business for two years using this with NO problems. This was the old 21.io bitcoin on raspberry pi. This could easily be built into coinbin.

OutCast3k commented 6 years ago

I will look into making a few updates based on your feedback soon.