pull down to refresh

GitHub RepositoryLightning Address
https://github.com/sfr0xyz/openagents-bitcoin-statssefiro@getalby.com
This is a plugin for OpenAgents that gives you the latest statistics about the Bitcoin network, its mempool and the Lightning Network.
It is inspired by Clark Moody's Bitcoin Dashboard and the TimeChainCalendar.
The project uses the Extism Framework, in particular its Go PDK, and the REST APIs of mempool.space, bitnodes.io and https://docs.coincap.io/.

Usage

Ensure that you have installed the Extism CLI and downloaded the btcstats.wasm file.
You can call the plugin with the Extism CLI:
extism call btcstats.wasm run --input '<YOUR INPUT>' --wasi --allow-host '*'
Replace <YOUR INPUT> with a list of statistics you are interested in.
Available statistics (see detailed descriptions on GitHub):
  • market: Bitcoin market data such as current price and market cap
  • latestBlock: Information about the latest block, such as size and total reward
  • mining: Mining data such as current hashrate and difficulty, and difficulty adjustment
  • fees: Recommended feerates based on the current mempool
  • mempool: Mempool statistics such as number of unconfirmed transactions and pending fees
  • lightning: Lightning Network statistics such as total capacity and number of channels
  • nodes: Bitcoin node statistics such as total number of nodes
You can include more than one of the above at once.
If you leave the field empty (''), or include none of the above, all stats will be requested.
With the prefix -, e.g. -nodes, you can exclude stats, i.e. "I want all stats except nodes".
Note: If you request the nodes statistic, it will take a while, a few seconds, for the result to be displayed.

Examples1

Note: The resulting JSON is prettified here for better readability.
Get latestBlock and mempool stats:
$ extism call btcstats.wasm run --input 'latestBlock mempool' --wasi --allow-host '*' { "latestBlock": { "height": 845325, "timestamp": "Mon, 27 May 2024 01:34:54 UTC", "transactions": 5692, "size": 1.55, "totalReward": 3.272, "totalFees": 0.147, "medianFeeRate": 8.1, "miner": "MARA Pool" }, "mempool": { "unconfirmedTXs": 170669, "vSize": 180.66, "pendingFees": 5.257, "blocksToClear": 181 }, "mining": { "hashrate": 677612693053317300000, "difficulty": 84381461788831.34, "retargetDifficultyChangePercent": 13.39, "retargetRemainingBlocks": 1395, "retargetEstimatedDate": "Tue, 04 Jun 2024 15:07:02 UTC" } }
Get all stats except nodes:
$ extism call btcstats.wasm run --input '-nodes' --wasi --allow-host '*' { "fees": { "fastest": 9, "halfHour": 9, "hour": 9, "economy": 6, "minimum": 3 }, "latestBlock": { "height": 845325, "timestamp": "Mon, 27 May 2024 01:34:54 UTC", "transactions": 5692, "size": 1.55, "totalReward": 3.272, "totalFees": 0.147, "medianFeeRate": 8.1, "miner": "MARA Pool" }, "lightning": { "totalNodes": 12836, "torNodes": 8930, "clearnetNodes": 1700, "clearnetTorNodes": 1360, "unannouncedNodes": 846, "channels": 50872, "totalCapacity": 4980.822, "averageChannelCapacity": 0.098, "medianChannelCapacity": 0.02 }, "market": { "supply": 19699693, "supplyPercent": 93.81, "price": 69020.61, "priceChange24hPercent": -0.32, "moscowTime": 1448, "marketCap": 1359684729700.71 }, "mempool": { "unconfirmedTXs": 170669, "vSize": 180.66, "pendingFees": 5.257, "blocksToClear": 181 }, "mining": { "hashrate": 677612693053317300000, "difficulty": 84381461788831.34, "retargetDifficultyChangePercent": 13.39, "retargetRemainingBlocks": 1395, "retargetEstimatedDate": "Tue, 04 Jun 2024 15:07:02 UTC" } }

Footnotes

  1. more examples in the README on GitHub
this territory is moderated
Excellent, thank you! Please DM me a bitcoin address on X to @OpenAgentsInc or email to chris@openagents.com
reply
Thank you! I've sent you an email. If there is anything else you need from me, please let me know.
reply