Bitcoin Forum
December 15, 2024, 03:42:56 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Using getrawmempool to estimate fees  (Read 176 times)
RGBKey (OP)
Hero Member
*****
Offline Offline

Activity: 854
Merit: 658


rgbkey.github.io/pgp.txt


View Profile WWW
January 23, 2018, 06:39:11 AM
Merited by ABCbits (1)
 #1

Currently I run a program to estimate the lowest fee rate likely to get into the next block. It connects to my local Bitcoin core bode via RPC and runs getrawmempool. It sorts the transactions by fee rate, then takes off the top 1 MB worth of transactions. The fee rate of the last transaction to get in is, in my mind at least a good estimate of the required fee to get into the next block.

I am aware that this is a fairly naive approach, and I would like to improve it. Currently, it does not account for the SegWit discount and will incorrectly decide how many transactions will fit in the block. Also, I am not sure if looking at the mempool is the best option, maybe a rolling average of the lowest fee included in the past 3 blocks would be better for instance.

If these kinds of fee estimation questions have been asked before, feel free to link me but I wasn't able to find what I was looking for.

tl;dr How can I improve my simple fee estimation to be smarter?
hatshepsut93
Legendary
*
Offline Offline

Activity: 3038
Merit: 2162


View Profile
January 23, 2018, 12:14:01 PM
 #2

Currently I run a program to estimate the lowest fee rate likely to get into the next block. It connects to my local Bitcoin core bode via RPC and runs getrawmempool. It sorts the transactions by fee rate, then takes off the top 1 MB worth of transactions. The fee rate of the last transaction to get in is, in my mind at least a good estimate of the required fee to get into the next block.

I am aware that this is a fairly naive approach, and I would like to improve it. Currently, it does not account for the SegWit discount and will incorrectly decide how many transactions will fit in the block. Also, I am not sure if looking at the mempool is the best option, maybe a rolling average of the lowest fee included in the past 3 blocks would be better for instance.

If these kinds of fee estimation questions have been asked before, feel free to link me but I wasn't able to find what I was looking for.

tl;dr How can I improve my simple fee estimation to be smarter?

When you look at latest blocks, you should check low-fee transactions for CPFP - they might be included in a block because their children compensated for low fee. Also, mining pools might include in blocks withdrawals of their members with lower fees, or they might include low fee transactions because they were paid through some other channels. So, you probably shouldn't expect that the lowest fee included in a recent block is safe enough to also get included in next few blocks - I'd raise that value by 10-20% to get some safer estimation.
shulio
Legendary
*
Offline Offline

Activity: 1540
Merit: 1016


View Profile
January 23, 2018, 03:37:50 PM
 #3

What I would do is I will calculate the fee as you do, and check the transactions that have minimum fee in latest 10 block and average them. If the calculation I do is lower than the average minimum of the latest 10 blocks, I will increase the fee.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!