Skip to content

Added components for difficulty adjustment#633

Merged
Randy808 merged 1 commit into
Blockstream:masterfrom
Randy808:difficulty-adjustment
Jul 10, 2026
Merged

Added components for difficulty adjustment#633
Randy808 merged 1 commit into
Blockstream:masterfrom
Randy808:difficulty-adjustment

Conversation

@Randy808

@Randy808 Randy808 commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

To run locally, npm install and use the following snippets:

# Bitcoin
export API_URL=https://blockstream.info/api
export PORT=4999
source flavors/blockstream/config.env
source flavors/bitcoin-mainnet/config.env
npm run dev-server
# Liquid
export API_URL=https://blockstream.info/liquid/api
export PORT=5000
source flavors/blockstream/config.env
source flavors/liquid-mainnet/config.env
npm run dev-server

Bitcoin:
Bitcoin difficulty adjustment component

Liquid:
No change to Liquid views

@Randy808 Randy808 self-assigned this Jun 29, 2026
@Randy808 Randy808 force-pushed the difficulty-adjustment branch from 1ce446b to 490dc07 Compare July 2, 2026 02:20
@Randy808 Randy808 marked this pull request as ready for review July 2, 2026 02:21
@Randy808 Randy808 force-pushed the difficulty-adjustment branch from 490dc07 to f4202e8 Compare July 2, 2026 02:24
Comment thread client/src/views/difficulty-adjustment.js Outdated
Comment thread client/src/views/difficulty-adjustment.js Outdated
Comment thread client/src/app.js Outdated
@Randy808 Randy808 force-pushed the difficulty-adjustment branch from f4202e8 to 2c2c774 Compare July 8, 2026 02:10
Comment thread client/src/views/difficulty-adjustment.js
Comment thread client/src/views/difficulty-adjustment.js
Comment thread client/src/views/difficulty-adjustment.js Outdated
Comment thread client/src/app.js
Comment on lines +78 to +81
const expectedAdjustment = (epochTiming) =>
epochTiming
? (TARGET_BLOCK_SECONDS / epochTiming.averageBlockSeconds - 1) * 100
: null;

@FedOken FedOken Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://wiki.bitcoinsv.io/index.php/Difficulty

In the original implementation, still used by Bitcoin Core (BTC), the difficulty can rise by a maximum of 400% of the current difficulty in a single adjustment.
In the original implementation, still used by Bitcoin Core (BTC), the network's difficulty can adjust downwards by up to 75% of the current difficulty in a single adjustment.

I think we should set limits regarding the protocol, regardless of the numbers that might be included in the calculation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced this belongs in the visualization layer. As I see it, this view is intended to visualize the calculated values rather than validate them against consensus rules.

If the calculated adjustment were to exceed the protocol's ±400%/-75% limits, what would we do with that information? Would we display a warning that the calculated value is invalid according to consensus? If so, I'm not sure why we'd make this particular consensus rule special when we don't surface other consensus validity checks here.

@Randy808 Randy808 force-pushed the difficulty-adjustment branch from 2c2c774 to f6f1301 Compare July 9, 2026 18:38
@Randy808 Randy808 merged commit 86fdd5e into Blockstream:master Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants