Command Palette

Search for a command to run...

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

bitcoin-libraries-bitcoin-kernel

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

libbitcoinkernel: Bitcoin Core's experimental C library exposing the validation engine (block/header validation, block index traversal, block + undo reads…

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

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

libbitcoinkernel / rust-bitcoinkernel

Core's validation engine, factored out as a C-ABI library. Two layers:

  • libbitcoinkernel - the C header src/kernel/bitcoinkernel.h in the Bitcoin Core tree, plus the bitcoinkernel CMake target.
  • bitcoinkernel - safe Rust bindings, over the libbitcoinkernel-sys FFI/build crate. Repo: github.com/sedited/rust-bitcoinkernel (the TheCharlatan/rust-bitcoinkernel URL still redirects there).

Status: experimental (as of September 2026)

The header's own Remarks section in Bitcoin Core v31.1 (July 2026) states the API "is unversioned and not stable yet. Users should expect breaking changes. It is also not yet included in releases of Bitcoin Core." Upstream tracking is bitcoin/bitcoin#27587, "Bitcoin Kernel Library Project Tracking" (open, last updated 31 July 2026).

It is not built by default. BUILD_KERNEL_LIB ("Build experimental bitcoinkernel library") defaults to the value of BUILD_UTIL_CHAINSTATE, which is OFF in v31.1, so you must opt in:

cmake -B build -DBUILD_KERNEL_LIB=ON       # BUILD_KERNEL_TEST follows it
cmake --build build

Treat the library as a moving target and pin an exact commit or crate version.

Why it exists

Core's old libbitcoinconsensus was deprecated in v27.0 and removed entirely in v28.0 (release notes, PR #29648) - src/script/bitcoinconsensus.h is present at tag v27.0 and gone at v28.0. It only ever did isolated script verification. The kernel library is the replacement and is stateful: it owns a chainstate, so it can validate whole blocks against real chain context, not just scripts.

Scope

Per the v31.1 header's Purpose section, the C API covers:

  • Block and block-header validation against consensus rules.
  • Iterating the block index / traversing the chain.
  • Reading block and undo data from disk.
  • Script verification.

No P2P, no wallet, no RPC server, no mempool acceptance. A context is passed to state-rich calls; a built-in static context covers the "context-free" operations (SHA256 implementation self-check, RNG init, secp256k1 static context self-check), so no explicit init is required for those.

Install (Rust)

# latest on crates.io as of September 2026
[dependencies]
bitcoinkernel = "0.3"        # 0.3.0, 26 August 2026; MSRV 1.71.0

libbitcoinkernel-sys (0.4.0, 26 August 2026) is pulled in transitively - depend on it directly only for raw FFI. All-time downloads as of September 2026: ~44.6k for bitcoinkernel, ~47.6k for libbitcoinkernel-sys.

Build requirements

libbitcoinkernel-sys vendors Bitcoin Core as a git subtree at libbitcoinkernel-sys/bitcoin and statically compiles the kernel library as part of cargo build. That means the host needs Core's own build dependencies - cmake, a working C and C++ toolchain, and an installation of Boost. First builds are slow; budget for them in CI.

Since bitcoinkernel 0.2.1 / libbitcoinkernel-sys 0.3.0 (both 20 May 2026) the sys crate ships checked-in bindings instead of generating them with bindgen, which upstream notes removes some build-time dependencies.

Users on rustc older than 1.77 should build with --locked (Cargo-minimal.lock / Cargo-recent.lock pin the two extremes). Android cross-compilation is available through the repo's Nix flake (nix build .#libbitcoinkernel-android-aarch64), targeting API 24+.

Quick examples

Validate a block

use bitcoinkernel::{
    Block, ChainType, ChainstateManager, ContextBuilder, ProcessBlockResult,
};

let context = ContextBuilder::new()
    .chain_type(ChainType::Mainnet)
    .build()?;

let chainman = ChainstateManager::new(&context, "/path/to/data", "/path/to/blocks")?;

let block = Block::new(&block_bytes)?;
match chainman.process_block(&block) {
    ProcessBlockResult::NewBlock => println!("validated and written to disk"),
    ProcessBlockResult::Duplicate => println!("already known (valid)"),
    ProcessBlockResult::Rejected => println!("validation failed"),
}

Verify a script

use bitcoinkernel::{prelude::*, verify, PrecomputedTransactionData, Transaction, VERIFY_ALL};

let spending_tx = Transaction::new(&spending_tx_bytes)?;
let prev_tx = Transaction::new(&prev_tx_bytes)?;
let prev_output = prev_tx.output(0)?;
let tx_data = PrecomputedTransactionData::new(&spending_tx, &[prev_output])?;

let result = verify(
    &prev_output.script_pubkey(),
    Some(prev_output.value()),
    &spending_tx,
    0,                      // input index
    Some(VERIFY_ALL),
    &tx_data,
);

Passing the spent outputs is what enables taproot verification; without them the precomputed data cannot produce a BIP341 sighash.

Crate layout

Module Holds
core Blocks, transactions, scripts
state ChainstateManager, Context, ChainParams
notifications Validation / tip-update / warning callbacks
log Bridge to Core's logging
prelude Extension traits (`ScriptPubkeyE
Полный SKILL.md на GitHub

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

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

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

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

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

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

Read
Grep
Glob

FAQ

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

libbitcoinkernel: Bitcoin Core's experimental C library exposing the validation engine (block/header validation, block index traversal, block + undo reads, script verification), and the `bitcoinkernel` Rust bindings over `libbitcoinkernel-sys`. USE WHEN: embedding Core's exact consensus semantics in a non-C++ process - indexers, explorers, validation tooling, fuzzing harnesses.

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

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

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

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

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

Сравнить bitcoin-libraries-bitcoin-kernel с