smithery/b-open-io

calculate-mining-difficulty

This skill should be used when the user asks to "calculate mining difficulty", "convert target to difficulty", "analyze block difficulty", "BSV difficulty calculation", or needs to compute difficulty from block headers.

Installation

$ npx skills add smithery/b-open-io --skill calculate-mining-difficulty

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/b-open-io · top by installs.

npx skills add smithery/b-open-io

Browse all from smithery/b-open-io

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Allowed toolsBash(bun:*)

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,319 B
  • docs SUMMARY.md 254 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Calculate Mining Difficulty

Calculate and analyze BSV mining difficulty from targets, bits, and network data.

When to Use

  • Get current network difficulty from WhatsOnChain
  • Convert between target and difficulty
  • Decode compact bits representation
  • Understand expected hash calculations for mining

Usage

# 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

Output

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"
}

Difficulty Math

The script uses the standard Bitcoin difficulty formula:

  • Max target: 0x00000000FFFF0000000000000000000000000000000000000000000000000000 (difficulty 1)
  • Difficulty: maxtarget / currenttarget
  • Compact bits format: First byte = exponent, next 3 bytes = mantissa

- target = mantissa 2^(8(exponent-3))

  • Expected hashes: difficulty * 2^32

API Integration

Uses WhatsOnChain API for current network data:

Status

Complete - All functionality implemented and tested.