RTL icon indicating copy to clipboard operation
RTL copied to clipboard

Integrate mempool.space fee rate api to provide users recommendations on fee rate

Open saubyk opened this issue 1 year ago • 3 comments

Mempool.space API can be integrated in the channel opening and on-chain spend interfaces to give users recommendation based on the current fee rates in the mempool

API: https://mempool.space/docs/api/rest#get-recommended-fees

saubyk avatar Jun 09 '23 01:06 saubyk

Oh cool, I see this API call works out the box on my self hosted mempool.space.

Err... not to be that feature guy, but would be cool to see this implemented in a way that allows overriding to one's own mempool.space instance. If it's done in a config file and not the UI, it's probably safe to assume the user knows what they are doing.

Just thinking about the whole third party thing

ghost avatar Jun 09 '23 02:06 ghost

Hi @shyfire131 wondering how would the API url look like if you have self host mempool.space If you can post a sample, that would be helpful

saubyk avatar Jun 09 '23 02:06 saubyk

It's the same really

Details

Running this:

curl --socks5 localhost:9050 --socks5-hostname localhost:9050 -s http://myhiddenservice.onion/api/v1/fees/recommended | jq

Response:

{
  "fastestFee": 27,
  "halfHourFee": 24,
  "hourFee": 20,
  "economyFee": 2,
  "minimumFee": 1
}

Verbose response from curl -v

*   Trying 127.0.0.1:9050...
* Connected to localhost (127.0.0.1) port 9050 (#0)
* SOCKS5 connect to myhiddenservice.onion:80 (remotely resolved)
* SOCKS5 request granted.
* Connected to localhost (127.0.0.1) port 9050 (#0)
> GET /api/v1/fees/recommended HTTP/1.1
> Host: myhiddenservice.onion
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Fri, 09 Jun 2023 05:15:21 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 312
< Connection: keep-alive
< X-Powered-By: Express
< Access-Control-Allow-Origin: *
< ETag: W/"138-WLg27yQG9EjCtCnCYKTKRFnIT9M"
< Cache-Control: public, no-transform
< Vary: Accept-Language
< Vary: Cookie
<
{ [312 bytes data]
* Connection #0 to host localhost left intact 
{
  "fastestFee": 27,
  "halfHourFee": 24,
  "hourFee": 20,
  "economyFee": 2,
  "minimumFee": 1
}

ghost avatar Jun 09 '23 05:06 ghost