Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bitcoin-schnorr

БесплатноБез исполняемых скриптовНе проверен

BIP340 Schnorr signatures over secp256k1: sign/verify, x-only pubkeys, tagged hashes, batch verification, key tweaking. Building block for Taproot, MuSig2…

claude-dev-suiteот claude-dev-suite★ 51 звезда на GitHub

Об этом скилле

BIP340 Schnorr Signatures

Quick refs: pseudocode.md, batch-verify.md, pitfalls.md

Schnorr is the signature scheme used in Taproot. Discovered in 1989, patent-encumbered until 2008, finally proposed for Bitcoin in 2018 (BIP340), activated 2021.

Why Schnorr over ECDSA

Property ECDSA Schnorr (BIP340)
Signature size ~71-72 bytes (DER) 64 bytes flat
Linearity No Yes
Batch verification No Yes (sub-linear)
Malleability Yes (low-s normalization required) No (canonical by construction)
Provable security requires assumption reducible to ECDLP in ROM
Key aggregation impossible enables MuSig2 / FROST

Linearity is the killer feature: Sig(k1+k2, m) ≠ Sig(k1,m) + Sig(k2,m) in ECDSA, but ... = ... in Schnorr (in a precise sense). This enables n-of-n key aggregation, MuSig2, FROST, adaptor signatures, scriptless scripts, DLCs.

Tagged hash framework

TaggedHash(tag, msg) = SHA256(SHA256(tag) || SHA256(tag) || msg)

Domain separation tags used in BIP340:

  • BIP0340/aux — for nonce derivation (auxiliary entropy).
  • BIP0340/nonce — for the deterministic nonce hash.
  • BIP0340/challenge — for the challenge hash e.

x-only pubkeys

Schnorr in BIP340 uses 32-byte x-only pubkeys. Implicit "even y" convention: when computing operations, you lift_x(P_x) to choose the point with even y, and adjust sign of secret key accordingly.

This halves key size and simplifies tweaking math.

Sign (high-level)

Inputs: secret key d (32 bytes), message m (any length), aux_rand (32 bytes optional)

1. P = d * G;  if P.y is odd, d = n - d  (force even-y).
2. t = d XOR TaggedHash("BIP0340/aux", aux_rand)    [nonce binding]
3. rand = TaggedHash("BIP0340/nonce", t || P.x || m)
4. k = int(rand) mod n;  if k == 0, abort.
5. R = k * G;  if R.y is odd, k = n - k.
6. e = TaggedHash("BIP0340/challenge", R.x || P.x || m)  mod n
7. s = (k + e*d) mod n
8. Output: (R.x, s) → 64 bytes.

m was restricted to 32 bytes until BIP340's 2023-04 revision lifted it; it is arbitrary-length now. In Bitcoin m is always the 32-byte BIP341 sighash. See pitfalls.md #5.

Verify

Inputs: pubkey P_x (32 bytes), message m, sig (R_x, s)

1. P = lift_x(P_x).
2. e = TaggedHash("BIP0340/challenge", R_x || P_x || m) mod n.
3. R' = s*G - e*P
4. Verify R'.y is even AND R'.x == R_x.

Batch verification

n signatures can be verified together in O(n) but with a smaller constant than n individual verifications. Random linear combinations prevent forgery:

For batch of (Pi, Ri, si, mi) for i in 1..n:
1. Generate random ai for each (a1=1 fixed for security).
2. Compute LHS = sum(ai * si) * G
3. Compute RHS = sum(ai * Ri) + sum(ai * ei * Pi)
4. If LHS == RHS, batch valid.

Typical speedup: 2-3x for ~100 sigs — but this is theory, not a deployed code path. libsecp256k1 exposes no batch-verify API and Bitcoin Core verifies each Taproot signature individually (as of September 2026). See batch-verify.md.

Key tweaking (BIP341)

Taproot tweak: Q = P + t*G where t = TaggedHash("TapTweak", P_x || R).

For signing on tweaked output:

secret_for_Q = (secret_for_P + t) mod n  (with parity adjustment)

This means: a Taproot wallet that holds d and knows the script tree can sign for Q using the standard BIP340 signing with the tweaked key.

Sig encoding in witness

  • SIGHASH_DEFAULT (= 0x00 byte after sig): omit, sig is 64 bytes.
  • Other sighash flags: append flag byte → 65 bytes.

Post-quantum outlook (as of September 2026)

BIP340 keys are the exposed surface in the quantum debate: Shor's algorithm recovers a secret key from a public key, and a Taproot key-path output publishes its 32-byte x-only key in the scriptPubKey, so it is breakable-in-principle long before it is ever spent ("long exposure"). A key revealed only in a mempool spend is the harder "short exposure" case.

Two drafts frame the response. Neither is activated and neither has consensus:

  • BIP 360, "Pay-to-Merkle-Root (P2MR)" (Beast, Heilman, Foxen Duke; Draft, Layer: Consensus (soft fork); assigned 2024-12-18, spec version 0.12.1 of 2026-07-24; Requires 340/341/342). A SegWit version 2 output whose witness program is the Merkle root of a script tree — a P2TR with the key path removed, bech32m addresses starting bc1z. It targets long exposure only and deliberately picks no PQ signature algorithm, leaving that to a later soft fork. Renamed from "P2QRH" (2025-09) then "P2TSH" (2026-02).
  • BIP 361, "Post Quantum Migration and Legacy Signature Sunset" (Lopp et al.; Draft, Layer: Consensus (soft fork), Type: Informational; assigned 2026-02-11). Phase A, 160,000 blocks (~3 years) after activation, disallows sending to quantum-vulnerable output types; Phase B
Полный SKILL.md на GitHub

Установить bitcoin-schnorr в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob

Вложенные файлы

quick-ref/batch-verify.mdquick-ref/pitfalls.mdquick-ref/pseudocode.md

FAQ

Что делает скилл bitcoin-schnorr?

BIP340 Schnorr signatures over secp256k1: sign/verify, x-only pubkeys, tagged hashes, batch verification, key tweaking. Building block for Taproot, MuSig2, FROST, adaptor signatures, DLCs. Quick refs: signing pseudocode, batch verification, common mistakes. USE WHEN: signing/verifying Taproot key-path or Tapscript spends, designing aggregation protocols, reading BIP340.

Как установить скилл bitcoin-schnorr?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bitcoin-schnorr запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bitcoin-schnorr с