DEV Community

PraxTube
PraxTube

Posted on

Fetching Bitcoin Mempool Data from the Terminal

For those of us who are doing most of their work in the terminal it can be very annoying to switch to a web browser for small tasks. For instance looking something up like the current Block height in the Bitcoin network or the current network fees. Granted, most people probably don't mind, but I do! So I wrote a little CLI to fetch some data from mempool.space and display the info in the terminal.

╭─────806_715──────╮  ╭─────806_714──────╮  ╭─────806_713──────╮  ╭─────806_712──────╮
│   ≈ 19 sat/vB    │  │   ≈ 17 sat/vB    │  │   ≈ 19 sat/vB    │  │   ≈ 26 sat/vB    │
│ 16 - 1508 sat/vB │  │ 16 - 302 sat/vB  │  │ 17 - 302 sat/vB  │  │ 19 - 1213 sat/vB │
│                  │  │                  │  │                  │  │                  │
│     2.00 MB      │  │     1.74 MB      │  │     1.49 MB      │  │     1.61 MB      │
│    3,663 txs     │  │    2,790 txs     │  │    2,589 txs     │  │    3,516 txs     │
│      F2Pool      │  │   Foundry USA    │  │     AntPool      │  │      ViaBTC      │
│                  │  │                  │  │                  │  │                  │
│  20 minutes ago  │  │  30 minutes ago  │  │  39 minutes ago  │  │  54 minutes ago  │
╰──────────────────╯  ╰──────────────────╯  ╰──────────────────╯  ╰──────────────────╯
╭─────806_711──────╮  ╭─────806_710──────╮  ╭─────806_709──────╮  ╭─────806_708──────╮
│   ≈ 15 sat/vB    │  │   ≈ 16 sat/vB    │  │   ≈ 21 sat/vB    │  │   ≈ 18 sat/vB    │
│ 15 - 256 sat/vB  │  │ 15 - 317 sat/vB  │  │ 18 - 697 sat/vB  │  │ 16 - 302 sat/vB  │
│                  │  │                  │  │                  │  │                  │
│     1.86 MB      │  │     1.79 MB      │  │     1.66 MB      │  │     1.52 MB      │
│    4,706 txs     │  │    3,267 txs     │  │    3,141 txs     │  │    2,278 txs     │
│    MARA Pool     │  │     AntPool      │  │      F2Pool      │  │      ViaBTC      │
│                  │  │                  │  │                  │  │                  │
│   1 hours ago    │  │   1 hours ago    │  │   1 hours ago    │  │   2 hours ago    │
╰──────────────────╯  ╰──────────────────╯  ╰──────────────────╯  ╰──────────────────╯

╭───────Halving in: 7 months, 84%────────╮  ╭────Difficulty Adj. in: 11 days, 16%────╮
│█████████████████████████████████       │  │██████                                  │
╰────────────────────────────────────────╯  ╰────────────────────────────────────────╯
Enter fullscreen mode Exit fullscreen mode

The output is pretty self-explanatory and is kept as similar to the mempool.space layout as possible. However it is static data, meaning we only get the receive data once. If you are looking for a live data feed (like it is on the mempool.space website) then check out mempool-cli.

In order to be able to get the same output as shown above, you can install Mr. TUI (Mempool Rust Terminal UI) by simply running

cargo install mrtui
Enter fullscreen mode Exit fullscreen mode

Then whenever you want to output the current blockchain data you can run

mrtui
Enter fullscreen mode Exit fullscreen mode

That's it! Now you can get simple information from the bitcoin network through the terminal.

Top comments (0)