Bitcoin Forum
December 14, 2024, 05:02:51 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting fee ranges for unconfirmed transactions, a la mempool.space  (Read 173 times)
RoxxR (OP)
Full Member
***
Offline Offline

Activity: 209
Merit: 148


View Profile
May 20, 2022, 08:34:21 AM
Merited by bitmover (1)
 #1

Does anyone know how of a mempool.space alternative, or a Python script, to calculate the fee ranges in the next few blocks (highlighted in red in this screenshot)?

NeuroticFish
Legendary
*
Offline Offline

Activity: 3878
Merit: 6623


Looking for campaign manager? Contact icopress!


View Profile
May 20, 2022, 09:51:48 AM
Merited by bitmover (2), ABCbits (1), n0nce (1)
 #2

If you have your own mempool, maybe consecutive calls of estimatesmartfee with increasing (or decreasing) parameter would do.
Or you can find web based mempools that allow API calls like https://mempool.space/api/v1/fees/mempool-blocks and parse/interpret the results, just make sure you're within the allowed amount of API calls for the platform(s).

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 3052
Merit: 4443


Crypto Swap Exchange


View Profile
May 20, 2022, 02:03:05 PM
Merited by bitmover (2), BlackHatCoiner (2), n0nce (1)
 #3

You can parse the mempool yourself if you require such data. The range of fees are not fee estimations but rather the range of fees in each segment. If I remember correctly, and from the looks of it they use the range of transaction fee rates within each segment of the mempool. I don't think they account for the growth rate of the mempool with respect to time so take the accuracy of it with a grain of salt (if you're estimating the fees of course).

Anyways, I'm not aware of any current implementations that does things like this. As mentioned, estimatesmartfee is the way to go. If you cannot work with that, then something that could work would be to dump the mempool (getrawmempool), organize the transactions in descending order. Then segment the transactions according to the size, get the boundaries of each segment and you're done.  This shouldn't be too difficult to do, might have some time to do it in the coming weeks but no guarantees.

Edit: There's mempool.observer as well as jochen-hoenicke.de/queue but they are both visual representation.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
n0nce
Hero Member
*****
Offline Offline

Activity: 910
Merit: 5935


not your keys, not your coins!


View Profile WWW
May 20, 2022, 10:03:46 PM
Merited by dkbit98 (1)
 #4

I needed something like this for my LED Bitcoin Dashboard [weekend project] and opted to simply use mempool.space's API for it. While I do have a full node on the same network, it was easier and faster to just use an online REST API than building something more custom - after all, it was a weekend project. Wink

The API endpoint I use to get the recommended fee:
Code:
https://mempool.space/api/v1/fees/recommended

Here you have their full API documentation:
https://mempool.space/docs/api/rest

Endpoint for recommended fees:
Endpoint
GET /api/v1/fees/recommended

Description
Returns our currently suggested fees for new transactions.

Code Example
Code:
curl -sSL "https://mempool.space/api/v1/fees/recommended"
Response
Code:
{
  fastestFee: 1,
  halfHourFee: 1,
  hourFee: 1,
  minimumFee: 1
}

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
ranochigo
Legendary
*
Offline Offline

Activity: 3052
Merit: 4443


Crypto Swap Exchange


View Profile
May 23, 2022, 02:28:53 PM
 #5

-snip-
I think those are the floating fee estimation which would be okay if OP is trying to estimate the fees for their transactions. I think OP is trying to get the range of fees, mempool.space also offers an API call for that: https://mempool.space/api/v1/fees/mempool-blocks(https://mempool.space/docs/api/rest#get-mempool-blocks-fees). The extremes of each block denotes the range of fees included in that estimated block.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
bitmover
Legendary
*
Offline Offline

Activity: 2520
Merit: 6372


Wheel of Whales 🐳


View Profile WWW
May 23, 2022, 03:19:48 PM
Merited by ABCbits (1), ranochigo (1)
 #6

Does anyone know how of a mempool.space alternative, or a Python script, to calculate the fee ranges in the next few blocks (highlighted in red in this screenshot)?


A simple python script using requests library and mempool.space data:

Code:
import requests

r = requests.get('https://mempool.space/api/v1/fees/recommended')

r.status_code
# 200

r.json()
# {'fastestFee': 17, 'halfHourFee': 10, 'hourFee': 1, 'minimumFee': 1}

r.json()['fastestFee']
#17

fastestFee next block
halfHourFee 3 blocks
hourFee 6 blocks


Edit: There's mempool.observer as well as jochen-hoenicke.de/queue but they are both visual representation.
I also made one visual representation , few years ago.

███████████▄
████████▄▄██
█████████▀█
███████████▄███████▄
█████▄█▄██████████████
████▄█▀▄░█████▄████████
████▄███░████████████▀
████░█████░█████▀▄▄▄▄▄
█████░█
██░█████████▀▀
░▄█▀
███░░▀▀▀██████
▀███████▄█▀▀▀██████▀
░░████▄▀░▀▀▀▀████▀
 

█████████████████████████
████████████▀░░░▀▀▀▀█████
█████████▀▀▀█▄░░░░░░░████
████▀▀░░░░░░░█▄░▄░░░▐████
████▌░░░░▄░░░▐████░░▐███
█████░░░▄██▄░░██▀░░░█████
█████▌░░▀██▀░░▐▌░░░▐█████
██████░░░░▀░░░░█░░░▐█████
██████▌░░░░░░░░▐█▄▄██████
███████▄░░▄▄▄████████████
█████████████████████████

█████████████████████████
████████▀▀░░░░░▀▀████████
██████░░▄██▄░▄██▄░░██████
█████░░████▀░▀████░░█████
████░░░░▀▀░░░░░▀▀░░░░████
████░░▄██░░░░░░░██▄░░████
████░░████░░░░░████░░████
█████░░▀▀░▄███▄░▀▀░░████
██████░░░░▀███▀░░░░██████
████████▄▄░░░░░▄▄████████
█████████████████████████
.
...SOL.....USDT...
...FAST PAYOUTS...
...BTC...
...TON...
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!