Command Palette

Search for a command to run...

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

bitcoin-p2p

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

Bitcoin P2P network protocol: messages, version handshake, addr/addrv2, compact blocks (BIP152), compact block filters (BIP157/158), v2 transport encryption…

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

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

Bitcoin P2P Protocol

The wire protocol Bitcoin nodes use to gossip transactions, blocks, and peer addresses. Default port: 8333 mainnet, 18333 testnet, 18444 regtest, 38333 signet.

Message frame

[4 bytes]   magic              # 0xf9beb4d9 mainnet
[12 bytes]  command (ASCII null-padded)
[4 bytes]   payload length (LE)
[4 bytes]   checksum = SHA256d(payload)[:4]
[N bytes]   payload

Handshake (no encryption / BIP324 v2)

Plaintext (legacy v1)

A → B: VERSION { protocol_version, services, timestamp, addr_recv, addr_from, nonce, user_agent, start_height, relay }
B → A: VERSION
B → A: VERACK
A → B: VERACK

Encrypted (BIP324 v2)

Introduced opt-in ("experimental", -v2transport) in Bitcoin Core 26.0 (December 2023); enabled by default since Core 27.0 (April 2024, PR #29347) and still default-on in Core 31.1 (July 2026). Disable with -v2transport=0. From 27.0 the manual connection options (-connect, -addnode, -seednode) and the addnode RPC also follow -v2transport, retrying v1 on failure. Differentiated by initial bytes (no magic in first message → v2 encrypted).

A → B: garbage + OUR_HKDF_SECRET (random 4 KiB max)
B → A: PEER_HKDF_SECRET + ECDH-derived nonce
... encrypted handshake completes, sets symmetric session keys ...
A → B: V2_VERSION (encrypted)
B → A: V2_VERSION
... VERACK and onward, encrypted ...

Provides confidentiality + authentication of the channel; does not authenticate identity (no keypair-based ID, only ephemeral session).

Post-quantum path — discussion only (as of September 2026)

BIP324 derives its session keys with ECDH, so a future quantum computer could recover them from a recorded handshake; an adversary can already store ciphertext today and decrypt later ("harvest now, decrypt later"). Olaoluwa Osuntokun opened the design discussion on bitcoin-dev in "A Post-Quantum Path for BIP 324" (2026-05-05, summarised in Optech #408, 2026-06-05). Deliberately not a BIP: it poses two questions.

  1. Hybrid or pure PQ KEM? ML-KEM (FIPS 203) is a KEM, and so is ECDH. A hybrid combiner keeps ellswift/ECDH and ML-KEM-768 so the channel survives either primitive breaking. A pure ML-KEM handshake drops ElligatorSwift entirely and sends the ~1.1 KB encapsulation key in its place, keeping garbage + terminator intact.
  2. Must the handshake still look like a uniform random string? An ML-KEM encapsulation key is a vector of polynomial coefficients mod 3329 and is recognisable on the wire. Kemeleon is the ML-KEM analogue of ElligatorSwift, but its indistinguishability is only computational (Module-LWE), where ElligatorSwift's is statistical. If the property is kept, two routes were sketched: classical-then-PQ-upgrade (run ML-KEM inside the existing v2 channel, then rekey), or an OEINC ("OINK") combiner in which the ellswift outer KEM encrypts a Kemeleon inner KEM in one round trip.

The thread ran 2026-05-05 to 2026-08-27 (7 messages). No BIP has been drafted and nothing is implemented in Bitcoin Core as of September 2026. This is the transport layer only — the consensus-layer PQ work on signatures and output types is a separate problem, see ../proposals/SKILL.md.

Service flags

Set in services field of VERSION:

  • NODE_NETWORK = 1 — serves the full chain.
  • NODE_GETUTXO = 2 — supports getutxos.
  • NODE_BLOOM = 4 — supports BIP37 bloom filtering (legacy SPV).
  • NODE_WITNESS = 8 — serves SegWit blocks.
  • NODE_COMPACT_FILTERS = 64 — serves BIP157/158 filters.
  • NODE_NETWORK_LIMITED = 1024 — pruned, only last ~288 blocks.
  • NODE_P2P_V2 = 2048 — supports BIP324 v2 transport.

Address gossip (addrv2, BIP155)

Replaces legacy addr. Supports:

  • IPv4 (network type 1).
  • IPv6 (2).
  • TORv2 (3, deprecated).
  • TORv3 (4).
  • I2P (5).
  • CJDNS (6).

getaddr ↔ addrv2 exchange. Periodic gossip: each peer broadcasts ~1000 addresses via addrv2 randomly.

Block & tx propagation

  • inv: announces tx/block hashes.
  • getdata: requests by hash + type.
  • block / tx: actual data.
  • headers: header-only sync (initial block download).
  • cmpctblock / blocktxn / getblocktxn (BIP152): compact block relay reduces 500-1000 ms gossip per block to ~30 ms by sending short txid prefixes.
  • wtxid relay (BIP339) — peers advertise via wtxidrelay message, then announce by wtxid → fixes legacy txid-collision attack.

Mempool sync

  • mempool: requests mempool inv.
  • feefilter: peer announces "don't relay below this fee rate".

Tx announcement rate limiting — global buckets

Status as of September 2026: PR #34628 "p2p: Replace per-peer transaction rate-limiting with global rate limits" merged 2026-07-25 under the 32.0 milestone. It is in the v32.0rc1 tag (2026-09-14) but there is no final 32.0 release, so every released line up to and including 31.1 (July 2026) still uses the old per-peer scheme.

Motivation: the per-peer `m_t

Полный SKILL.md на GitHub

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

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

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

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

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

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

Read
Grep
Glob

FAQ

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

Bitcoin P2P network protocol: messages, version handshake, addr/addrv2, compact blocks (BIP152), compact block filters (BIP157/158), v2 transport encryption (BIP324), wtxid relay (BIP339), Erlay (BIP330), Dandelion++ (BIP156). USE WHEN: implementing/debugging a node, integrating with bitcoind P2P, understanding address gossip, designing privacy-preserving propagation.

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

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

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

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

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

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