skills/stratum-v2/SKILL.md
This skill should be used when the user asks "what is Stratum v2", "mining protocol v2", "binary mining protocol", "encrypted mining", "job declaration protocol", or needs to understand Stratum v2 for BSV mining infrastructure.
npx skillsauth add b-open-io/bsv-skills stratum-v2Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Stratum v2 is the next-generation mining protocol developed by Braiins (Slush Pool), designed to address the limitations of Stratum v1. It introduces binary framing, end-to-end encryption, and decentralized job declaration.
| Feature | Stratum v1 | Stratum v2 | |---------|------------|------------| | Format | JSON-RPC text | Binary framed | | Bandwidth | ~100% baseline | ~30% reduction | | Encryption | None (plaintext) | Noise Protocol (AEAD) | | Authentication | Password-based | Cryptographic | | Job Selection | Pool-controlled | Miner-declarable | | Efficiency | Higher latency | Lower latency |
Stratum v2 consists of three subprotocols:
Core work distribution between pool and miners.
Allows miners to construct their own block templates.
Distributes block templates from Bitcoin nodes to pools/miners.
+------------------+------------------+------------------+
| Extension Type | Message Type | Message Length |
| (2 bytes) | (1 byte) | (3 bytes) |
+------------------+------------------+------------------+
| Payload |
| (variable length) |
+--------------------------------------------------------+
| Type | Description | Size | |------|-------------|------| | U8 | Unsigned 8-bit | 1 byte | | U16 | Unsigned 16-bit LE | 2 bytes | | U24 | Unsigned 24-bit LE | 3 bytes | | U32 | Unsigned 32-bit LE | 4 bytes | | U256 | 256-bit hash | 32 bytes | | STR0_255 | Length-prefixed string | 1 + n bytes | | B0_32 | Length-prefixed bytes | 1 + n bytes | | B0_64K | Length-prefixed bytes | 2 + n bytes | | SEQ0_64K | Sequence of items | 2 + items |
Stratum v2 uses the Noise Protocol Framework with:
1. Client initiates Noise handshake
2. Server provides certificate (signed by authority)
3. Encrypted channel established
4. All subsequent messages encrypted
SetupConnection
{
protocol: U32,
min_version: U16,
max_version: U16,
flags: U32,
endpoint_host: STR0_255,
endpoint_port: U16,
vendor: STR0_255,
hardware_version: STR0_255,
firmware: STR0_255,
device_id: STR0_255
}
SetupConnection.Success
{
used_version: U16,
flags: U32
}
OpenStandardMiningChannel
{
request_id: U32,
user_identity: STR0_255,
nominal_hash_rate: F32,
max_target: U256
}
OpenStandardMiningChannel.Success
{
request_id: U32,
channel_id: U32,
target: U256,
extranonce_prefix: B0_32,
group_channel_id: U32
}
NewMiningJob
{
channel_id: U32,
job_id: U32,
future_job: BOOL,
version: U32,
version_rolling_allowed: BOOL
}
SetNewPrevHash
{
channel_id: U32,
job_id: U32,
prev_hash: U256,
min_ntime: U32,
nbits: U32
}
SubmitSharesStandard
{
channel_id: U32,
sequence_number: U32,
job_id: U32,
nonce: U32,
ntime: U32,
version: U32
}
SubmitShares.Success
{
channel_id: U32,
last_sequence_number: U32,
new_submits_accepted_count: U32,
new_shares_sum: U64
}
Enables miners to select transactions for blocks:
DeclareMiningJob
{
request_id: U32,
mining_job_token: B0_255,
version: U32,
coinbase_prefix: B0_64K,
coinbase_suffix: B0_64K,
tx_short_hash_nonce: U64,
tx_short_hash_list: SEQ0_64K[U64],
tx_hash_list_hash: U256,
excess_data: B0_64K
}
Distributes templates from Bitcoin node to pools/miners:
NewTemplate
{
template_id: U64,
future_template: BOOL,
version: U32,
coinbase_tx_version: U32,
coinbase_prefix: B0_64K,
coinbase_tx_input_sequence: U32,
coinbase_tx_value_remaining: U64,
coinbase_tx_outputs_count: U32,
coinbase_tx_outputs: B0_64K,
coinbase_tx_locktime: U32,
merkle_path: SEQ0_255[U256]
}
Client: {"method":"mining.subscribe","params":["Agent/1.0"],"id":1}
Server: {"result":[[["mining.set_difficulty","1"],["mining.notify","1"]],"08000000",4],"id":1}
Client: {"method":"mining.authorize","params":["user.worker",""],"id":2}
Server: {"result":true,"id":2}
Server: {"method":"mining.set_difficulty","params":[1024]}
Server: {"method":"mining.notify","params":["job1","prev...","cb1","cb2",[],"ver","bits","time",true]}
Client: {"method":"mining.submit","params":["user.worker","job1","00000000","time","nonce"],"id":3}
Server: {"result":true,"id":3}
1. Noise handshake (encrypted channel established)
2. SetupConnection → SetupConnection.Success
3. OpenStandardMiningChannel → OpenStandardMiningChannel.Success
4. SetTarget (difficulty)
5. NewMiningJob + SetNewPrevHash (job assignment)
6. SubmitSharesStandard → SubmitShares.Success
Many pools run both:
Translation proxies can bridge v1 miners to v2 pools.
Stratum Reference Implementation (SRI):
Components:
roles/pool - Mining pool roleroles/mining-proxy - Proxy/translatorroles/jd-client - Job declaration clientroles/jd-server - Job declaration server| Component | Availability | |-----------|--------------| | Protocol Spec | Complete | | Reference Implementation | Production | | Pool Support | Growing | | ASIC Firmware | Limited | | BSV Support | Future |
Stratum v2 Ports (typical):
Key Crates (Rust):
[dependencies]
binary_sv2 = "1.0"
codec_sv2 = "1.0"
framing_sv2 = "1.0"
noise_sv2 = "1.0"
development
This skill should be used when the user asks to integrate "Yours Wallet", "connect a BSV wallet", use "BRC-100", "pay with BSV wallet", add "wallet checkout in a web app", use "yours-wallet-provider", build a "pay with Yours Wallet" button, access "window.CWI", or connect a React app to a BRC-100 wallet.
development
This skill should be used when the user asks to "send BSV", "transfer satoshis", "create payment transaction", "send from WIF", "P2PKH transaction", or needs to build, sign, and broadcast P2PKH transactions from a WIF private key using @bsv/sdk.
development
This skill should be used when the user asks to "encrypt message with BSV key", "decrypt with private key", "ECDH encryption", "AES-256-GCM BSV", "EncryptedMessage", "BRC-2 encryption", or needs to encrypt/decrypt data using BSV keys and @bsv/sdk.
tools
This skill should be used when the user asks to "implement BRC-100 wallet", "use wallet-toolbox", "TypeScript BSV wallet", "BRC-100 implementation", "desktop wallet", "Electron wallet", "browser wallet", "IndexedDB wallet storage", "wallet actions", "wallet baskets", "UTXO management", "createAction", "listOutputs", "wallet certificates", "WalletClient", "noSend", "BEEF payment", "pay-beef", "send BEEF", "Transaction.fromBEEF", "toHexBEEF", or needs guidance on building conforming wallets using @bsv/wallet-toolbox or connecting to a user's BRC-100 wallet via WalletClient.