Difficulty Epoch Script

An image of the progress through current difficulty epoch denoting blocks expected (green), ahead of schedule (yellow), or behind schedule (red) with estimate of next increase.

Difficulty Epoch

This script will prepare an image representing the number of blocks that have been mined thus far in the current difficulty epoch, and indicate if the pace is ahead of schedule or behind, with an estimated difficulty adjustment to occur when the next epoch begins. Each difficulty epoch consists of 2016 blocks.

It depends on a bitcoin node.

difficulty epoch image sample showing several blocks mined, and ahead of schedule

Like other Bitcoin dependent panels, the Difficulty Epoch panel can also use a pruned node, though a loss of estimate accuracy will result. The following example depicts pruned blocks at the beginning of the Difficulty Epoch, and warns about the loss of accuracy as a result of the pruned block height

difficulty epoch image on a pruned node

Script Location

The script is installed at ~/nodeyez/scripts/difficultyepoch.py.

Configuration

To manage and configure this script, use the nodeyez-config tool

sudo nodeyez-config

To manually configure this script, edit the ~/nodeyez/config/difficultyepoch.json file

Fields are defined below

field name description
aheadColor The color to fill in the block when ahead of schedule, expressed as a Hexadecimal color specifier. Default #ffff40
backgroundColor The background color of the image expressed as a hexadecimal color specifier. Default #000000
behindColor The color to draw the grid for a block when its not yet mined and was expected to be, expressed as a Hexadecimal color specifier. Default #ff0000
gridColor The base color of the grid representing each block during the difficulty period, expressed as a Hexadecimal color specifier. Default #404040
height The height, in pixels, to generate the image. Default 320
interval The amount of time, in seconds, the script should wait before data gathering and image creation again. Default 540
minedColor The color to fill in the block when it has been mined by the time expected, expressed as a Hexadecimal color specifie. Default #40ff40
saveEachBlockEnabled Indicates whether the result for each block should be saved as a separate image. Useful as source for animated composites. Default false
textColor The color of the text expressed as a Hexadecimal color specifier. Default #ffffff
width The width, in pixels, to generate the image. Default 480

Run Directly

Ensure the virtual environment is activated

source ~/.pyenv/nodeyez/bin/activate

Change to the scripts folder

cd ~/nodeyez/scripts

Run it

python difficultyepoch.py

Press CTRL+C to stop the process

Run at Startup

To enable the script to run at startup, as the privileged user run the following

sudo systemctl enable nodeyez-difficultyepoch.service

sudo systemctl start nodeyez-difficultyepoch.service

Home