Skip to content

Commit

Permalink
Add fee histogram to mempool panel (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
vicariousdrama authored May 7, 2022
1 parent 075bab6 commit b57224d
Show file tree
Hide file tree
Showing 5 changed files with 260 additions and 100 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ New Panels and Enhancements
- Enhanced Daily Data Retrieval - support for slushpool data
- Enhanced Raretoshi panel to allow for traversing user randomly
- Enhanced Raretoshi panel to support QR code hyperlink
- Enhanced Mempool panel to show fee histogram as a bar and improve config

General
- Externalized configuration from scripts to json files
Expand Down
72 changes: 61 additions & 11 deletions docs/script-mempoolblocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,72 @@ at [/home/nodeyez/nodeyez/scripts/mempoolblocks.py](../scripts/mempoolblocks.py)
| sleepInterval | The amount of time, in seconds, the script should wait before data gathering and image creation again. Default `300` |
| urlmempool | The url for the mempool blocks information. If you are running your own mempool.space service on MyNodeBTC, then use http://127.0.0.1:4080/api/v1/fees/mempool-blocks. Default `https://mempool.space/api/v1/fees/mempool-blocks` |
| urlfeerecs | The url for the mempool fees recommendation. If you are running your own mempool.space service on MyNodeBTC, then use http://127.0.0.1:4080/api/v1/fees/recommended. Default `https://mempool.space/api/v1/fees/recommended` |
| urlfeehistogram | The url for the mempool fee histogram data. If you are running your own mempool.space service on MyNodeBTC, then use http://127.0.0.1:4080/api/mempool. Default `https://mempool.space/api/mempool` |
| colorBlockEdgeOutline | The color to use for the outline of block shapes expressed as a Hexadecimal color specifier. Default `#202020` |
| colorBlockSide | The color to use for the side of the block expressed as a Hexadecimal color specifier. Default `#404040` |
| colorBlockTop | The color to use for the top of the block expressed as a Hexadecimal color specifier. Default `#606060` |
| satLevel1 | The recommended fee level to render blocks with colorBlock1 as sats per vbyte. Default `10` |
| satLevel2 | The recommended fee level to render blocks with colorBlock2 as sats per vbyte. Default `30` |
| satLevel3 | The recommended fee level to render blocks with colorBlock3 as sats per vbyte. Default `60` |
| satLevel4 | The recommended fee level to render blocks with colorBlock4 as sats per vbyte. Default `100` |
| satLevel5 | The recommended fee level to render blocks with colorBlock5 as sats per vbyte. Default `150` |
| colorBlock0 | The default color to use for the face of the block expressed as a Hexadecimal color specifier. Default `#40c040` |
| colorBlock1 | The color to use for blocks higher where recommended fee is higher than satLevel1 expressed as a Hexadecimal color specifier. Default `#c0ca33` |
| colorBlock2 | The color to use for blocks higher where recommended fee is higher than satLevel2 expressed as a Hexadecimal color specifier. Default `#fdd83f` |
| colorBlock3 | The color to use for blocks higher where recommended fee is higher than satLevel3 expressed as a Hexadecimal color specifier. Default `#f4511e` |
| colorBlock4 | The color to use for blocks higher where recommended fee is higher than satLevel4 expressed as a Hexadecimal color specifier. Default `#b71c1c` |
| colorBlock5 | The color to use for blocks higher where recommended fee is higher than satLevel5 expressed as a Hexadecimal color specifier. Default `#4a148c` |
| blockSatLevels | A array of one or more block sat level definitions to influence block color rendering by median sat/vB. The structure of a satlevel definition is defined below. |
| histogramSatLevels | An array of one or more histogram sat level definitions to show fee level histogram by sat/vB of transactions in the mempool. The structure is defined below. |
| blocksToRender | The maximum number (1-6) of upcoming blocks to render which will influence the size of the blocks drawn. Default `3` |

__blockSatLevels__

| field name | description |
| --- | --- |
| satMin | The minimum sat/vbyte value to apply this colorset |
| satMax | The maximum sat/vbyte value to apply this colorset |
| colorBlock | The color to use for the face of the block when the sat/vbyte is within range of satMin-satMax |
| colorText | The color to use for the text of the block when the sat/vbyte is within range of satMin-satMax |

Default definition based on mempool.space

```json
blockSatLevels = [
{"satMin": 0.0, "satMax": 10.0, "colorBlock": "#40c040", "colorText": "#ffffff"},
{"satMin": 10.0, "satMax": 30.0, "colorBlock": "#9ea90b", "colorText": "#ffffff"},
{"satMin": 30.0, "satMax": 60.0, "colorBlock": "#d1ac08", "colorText": "#ffffff"},
{"satMin": 60.0, "satMax": 100.0, "colorBlock": "#f4511e", "colorText": "#ffffff"},
{"satMin": 100.0, "satMax": 150.0, "colorBlock": "#b71c1c", "colorText": "#ffffff"},
{"satMin": 150.0, "satMax": 9999.0, "colorBlock": "#4a148c", "colorText": "#ffffff"}
]
```

__histogramSatLevels__

| field name | description |
| --- | --- |
| satMin | The minimum sat/vbyte value to apply this colorset |
| satMax | The maximum sat/vbyte value to apply this colorset |
| colorFill | The color to use for the graph portion when the sat/vbyte is within range of satMin-satMax |

Default definition based on mempool.space

```json
histogramSatLevels: [
{"satMin": 0.0, "satMax": 2.0, "colorFill": "#d81b60"},
{"satMin": 2.0, "satMax": 3.0, "colorFill": "#8e24aa"},
{"satMin": 3.0, "satMax": 4.0, "colorFill": "#5e35b1"},
{"satMin": 4.0, "satMax": 5.0, "colorFill": "#3949ab"},
{"satMin": 5.0, "satMax": 6.0, "colorFill": "#1e88e5"},
{"satMin": 6.0, "satMax": 8.0, "colorFill": "#039be5"},
{"satMin": 8.0, "satMax": 10.0, "colorFill": "#00acc1"},
{"satMin": 10.0, "satMax": 12.0, "colorFill": "#00897b"},
{"satMin": 12.0, "satMax": 15.0, "colorFill": "#43a047"},
{"satMin": 15.0, "satMax": 20.0, "colorFill": "#7cb342"},
{"satMin": 20.0, "satMax": 30.0, "colorFill": "#c0ca33"},
{"satMin": 30.0, "satMax": 40.0, "colorFill": "#fdd835"},
{"satMin": 40.0, "satMax": 50.0, "colorFill": "#ffb300"},
{"satMin": 50.0, "satMax": 60.0, "colorFill": "#fb8c00"},
{"satMin": 60.0, "satMax": 70.0, "colorFill": "#f4511e"},
{"satMin": 70.0, "satMax": 80.0, "colorFill": "#6d4c41"},
{"satMin": 80.0, "satMax": 90.0, "colorFill": "#757575"},
{"satMin": 90.0, "satMax": 100.0, "colorFill": "#546e7a"},
{"satMin": 100.0, "satMax": 125.0, "colorFill": "#b71c1c"},
{"satMin": 125.0, "satMax": 150.0, "colorFill": "#880e4f"},
{"satMin": 150.0, "satMax": 9999.0, "colorFill": "#4a148c"}
]
```

After making changes, Save (CTRL+O) and Exit (CTRL+X) nano.


Expand Down
Binary file modified images/mempoolblocks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 45 additions & 33 deletions sample-config/mempoolblocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"urlfeerecs.comment": "The url for the mempool fees recommendation. If you are running your own mempool.space service on MyNodeBTC, then use http://127.0.0.1:4080/api/v1/fees/recommended",
"urlfeerecs.type": "string",
"urlfeerecs": "https://mempool.space/api/v1/fees/recommended",
"urlfeehistogram.comment": "The url for the mempool fee histogram data. If you are running your own mempool.space service on MyNodeBTC, then use http://127.0.0.1:4080/api/mempool",
"urlfeehistogram.type": "string",
"urlfeehistogram": "https://mempool.space/api/mempool",
"colorBackground.comment": "The background color of the image expressed as a Hexadecimal color specifier",
"colorBackground.type": "string",
"colorBackground": "#000000",
Expand All @@ -23,39 +26,48 @@
"colorTextFG.comment": "The color of the text expressed as a Hexadecimal color specifier",
"colorTextFG.type": "string",
"colorTextFG": "#ffffff",
"satLevel1.comment": "The recommended fee level to render blocks with colorBlock1 as sats per vbyte",
"satLevel1.type": "integer",
"satLevel1": 10,
"satLevel2.comment": "The recommended fee level to render blocks with colorBlock2 as sats per vbyte",
"satLevel2.type": "integer",
"satLevel2": 30,
"satLevel3.comment": "The recommended fee level to render blocks with colorBlock3 as sats per vbyte",
"satLevel3.type": "integer",
"satLevel3": 60,
"satLevel4.comment": "The recommended fee level to render blocks with colorBlock4 as sats per vbyte",
"satLevel4.type": "integer",
"satLevel4": 100,
"satLevel5.comment": "The recommended fee level to render blocks with colorBlock5 as sats per vbyte",
"satLevel5.type": "integer",
"satLevel5": 150,
"colorBlock0.comment": "The default color to use for the face of the block expressed as a Hexadecimal color specifier",
"colorBlock0.type": "string",
"colorBlock0": "#40c040",
"colorBlock1.comment": "The color to use for blocks higher where recommended fee is higher than satLevel1 expressed as a Hexadecimal color specifier",
"colorBlock1.type": "string",
"colorBlock1": "#c0ca33",
"colorBlock2.comment": "The color to use for blocks higher where recommended fee is higher than satLevel2 expressed as a Hexadecimal color specifier",
"colorBlock2.type": "string",
"colorBlock2": "#fdd835",
"colorBlock3.comment": "The color to use for blocks higher where recommended fee is higher than satLevel3 expressed as a Hexadecimal color specifier",
"colorBlock3.type": "string",
"colorBlock3": "#f4511e",
"colorBlock4.comment": "The color to use for blocks higher where recommended fee is higher than satLevel4 expressed as a Hexadecimal color specifier",
"colorBlock4.type": "string",
"colorBlock4": "#b71c1c",
"colorBlock5.comment": "The color to use for blocks higher where recommended fee is higher than satLevel5 expressed as a Hexadecimal color specifier",
"colorBlock5.type": "string",
"colorBlock5": "#4a148c",
"blockSatLevels.comment": "An array of sat level fee definitions with creating the mempool blocks",
"blockSatLevels.type": "array",
"blockSatLevels": [
{"satMin.comment": "The minimum sat/vbyte value to apply this colorset", "satMin.type": "float",
"satMax.comment": "The maximum sat/vbyte value to apply this colorset", "satMax.type": "float",
"colorBlock.comment": "The color to use for the face of the block when the sat/vbyte is within range of satMin-satMax", "colorBlock.type": "string",
"colorText.comment": "The color to use for the text of the block when the sat/vbyte is within range of satMin-satMax", "colorText.type": "string",
"satMin": 0.0, "satMax": 10.0, "colorBlock": "#40c040", "colorText": "#ffffff"},
{"satMin": 10.0, "satMax": 30.0, "colorBlock": "#9ea90b", "colorText": "#ffffff"},
{"satMin": 30.0, "satMax": 60.0, "colorBlock": "#d1ac08", "colorText": "#ffffff"},
{"satMin": 60.0, "satMax": 100.0, "colorBlock": "#f4511e", "colorText": "#ffffff"},
{"satMin": 100.0, "satMax": 150.0, "colorBlock": "#b71c1c", "colorText": "#ffffff"},
{"satMin": 150.0, "satMax": 9999.0, "colorBlock": "#4a148c", "colorText": "#ffffff"}
],
"histogramSatLevels.comment": "An array of sat level fee definitions with creating the histogram chart",
"histogramSatLevels.type": "array",
"histogramSatLevels": [
{"satMin.comment": "The minimum sat/vbyte value to apply this colorset", "satMin.type": "float",
"satMax.comment": "The maximum sat/vbyte value to apply this colorset", "satMax.type": "float",
"colorFill.comment": "The color to use for the graph portion when the sat/vbyte is within range of satMin-satMax", "colorFill.type": "string",
"satMin": 0.0, "satMax": 2.0, "colorFill": "#d81b60"},
{"satMin": 2.0, "satMax": 3.0, "colorFill": "#8e24aa"},
{"satMin": 3.0, "satMax": 4.0, "colorFill": "#5e35b1"},
{"satMin": 4.0, "satMax": 5.0, "colorFill": "#3949ab"},
{"satMin": 5.0, "satMax": 6.0, "colorFill": "#1e88e5"},
{"satMin": 6.0, "satMax": 8.0, "colorFill": "#039be5"},
{"satMin": 8.0, "satMax": 10.0, "colorFill": "#00acc1"},
{"satMin": 10.0, "satMax": 12.0, "colorFill": "#00897b"},
{"satMin": 12.0, "satMax": 15.0, "colorFill": "#43a047"},
{"satMin": 15.0, "satMax": 20.0, "colorFill": "#7cb342"},
{"satMin": 20.0, "satMax": 30.0, "colorFill": "#c0ca33"},
{"satMin": 30.0, "satMax": 40.0, "colorFill": "#fdd835"},
{"satMin": 40.0, "satMax": 50.0, "colorFill": "#ffb300"},
{"satMin": 50.0, "satMax": 60.0, "colorFill": "#fb8c00"},
{"satMin": 60.0, "satMax": 70.0, "colorFill": "#f4511e"},
{"satMin": 70.0, "satMax": 80.0, "colorFill": "#6d4c41"},
{"satMin": 80.0, "satMax": 90.0, "colorFill": "#757575"},
{"satMin": 90.0, "satMax": 100.0, "colorFill": "#546e7a"},
{"satMin": 100.0, "satMax": 125.0, "colorFill": "#b71c1c"},
{"satMin": 125.0, "satMax": 150.0, "colorFill": "#880e4f"},
{"satMin": 150.0, "satMax": 9999.0, "colorFill": "#4a148c"}
],
"blocksToRender.comment": "The maximum number (1-6) of upcoming blocks to render which will influence the size of the blocks drawn",
"blocksToRender.type": "integer",
"blocksToRender": 3,
Expand Down
Loading

0 comments on commit b57224d

Please sign in to comment.