Calculate and analyze BSV mining difficulty from block headers and targets.
Calculate BSV mining difficulty from block headers, bits, or target values. Use when you need to decode compact bits format, convert between difficulty and target, or fetch current network difficulty from WhatsOnChain.
/plugin marketplace add b-open-io/bsv-skills/plugin install bsv-skills@b-open-ioThis skill is limited to using the following tools:
PRD.mdprogress.txtscripts/difficulty.test.tsscripts/difficulty.tsCalculate and analyze BSV mining difficulty from targets, bits, and network data.
# Get current network difficulty
bun run skills/calculate-mining-difficulty/scripts/difficulty.ts --current
# Calculate from compact bits (e.g., genesis block)
bun run skills/calculate-mining-difficulty/scripts/difficulty.ts --bits 0x1d00ffff
# Calculate from target hex (64 characters)
bun run skills/calculate-mining-difficulty/scripts/difficulty.ts --target 00000000ffff0000000000000000000000000000000000000000000000000000
# JSON output for scripting
bun run skills/calculate-mining-difficulty/scripts/difficulty.ts --bits 0x1d00ffff --json
# Show help
bun run skills/calculate-mining-difficulty/scripts/difficulty.ts --help
Default output:
Mining Difficulty Analysis
==========================
Difficulty: 1
Target: 0x00000000ffff0000000000000000000000000000000000000000000000000000
Bits: 0x1d00ffff
Expected hashes: 4.29e+9
JSON output (--json):
{
"difficulty": 1,
"target": "00000000ffff0000000000000000000000000000000000000000000000000000",
"bits": "1d00ffff",
"expectedHashes": "4.29e+9"
}
The script uses the standard Bitcoin difficulty formula:
0x00000000FFFF0000000000000000000000000000000000000000000000000000 (difficulty 1)max_target / current_targettarget = mantissa * 2^(8*(exponent-3))difficulty * 2^32Uses WhatsOnChain API for current network data:
GET https://api.whatsonchain.com/v1/bsv/main/chain/infoComplete - All functionality implemented and tested.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.