Skip to content

Commit

Permalink
Create mempool
Browse files Browse the repository at this point in the history
Adds a plugin to show current mempool stats and transaction fees on mempool.space
  • Loading branch information
jonathanalevi authored Jun 28, 2021
1 parent cecd46a commit fc96b3c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Cryptocurrency/Bitcoin/mempool
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Shows latest Bitcoin network fees on mempool.space (slow, medium, and fast via dropdown), and allows the user to select a default view for the bar itself.
#
# <xbar.title>Mempool Bitcoin Fees Estimator</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Jonathan A Levi</xbar.author>
# <xbar.author.github>entreprenewer</xbar.author.github>
# <xbar.desc>Shows latest Bitcoin network fees on mempool.space (slow, medium, and fast via dropdown), and allows the user to select a default view for the bar itself. </xbar.desc>
# <xbar.image>https://i.imgur.com/krOybyz.png</xbar.image>
#
# by Jonathan A Levi
# Based on Bitfinex bitbar plugin by Roberto Santacroce Martins and Dash tickers: Coincap.io and Poloniex.com by UdjinM6

# Grab all info beforehand
fee_info=$(curl -s "https://mempool.space/api/v1/fees/recommended")
fast=$(curl -s "https://mempool.space/api/v1/fees/recommended" | egrep -o '"fastestFee":[0-9]+(\.)?([0-9]{0,2})?' | sed 's/"fastestFee"://')
medium=$(curl -s "https://mempool.space/api/v1/fees/recommended" | egrep -o '"halfHourFee":[0-9]+(\.)?([0-9]{0,2})?' | sed 's/"halfHourFee"://')
slow=$(curl -s "https://mempool.space/api/v1/fees/recommended" | egrep -o '"hourFee":[0-9]+(\.)?([0-9]{0,2})?' | sed 's/"hourFee"://')

# SET DEFAULT VIEW HERE
# (Replace with $slow, $medium, or $fast)
default=$slow


#Menu bar
printf "%ld sat/vB\n" $default
echo "---"
printf "Slow: %ld sat/vB | color=red\n" $slow
printf "Medium: %ld sat/vB | color=orange\n" $medium
printf "Fast: %ld sat/vB | color=green\n" $fast
echo "Visit Mempool | href=\"https://mempool.space\""

0 comments on commit fc96b3c

Please sign in to comment.