Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Bitcoin Kernel

ASecurity

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.

33 stars
0 votes
0 copies
0 views
Added 9/22/2026
ai-agentsrustgoc++bashnodegitapi

Works with

api

Security Analysis

A100/100

Scanned 9/22/2026

$npx -y skills add claude-dev-suite/claude-dev-suite --skill bitcoin-kernel --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bitcoin Kernel?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Bitcoin Kernel
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/claude-dev-suite-bitcoin-kernel/badge)](https://www.skillsdirectory.com/skills/claude-dev-suite-bitcoin-kernel)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: bitcoin-libraries-bitcoin-kernel
description: |
  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.
allowed-tools: Read, Grep, Glob
---

# 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:

```bash
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)

```toml
# 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

```rust
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

```rust
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 (`ScriptPubkeyExt`, `TxInExt`, ...) |

0.3.0 (August 2026) added context-free `Block::check` and
`Transaction::check`, witness-stack accessors (`TxInExt::witness_stack`),
a typed `ScriptVerificationFlags` in place of a bare `u32`, and
`ChainParams::new_signet` / `ContextBuilder::signet` for custom signets.

## Use cases

- **Indexers and explorers in Rust** that must agree with Core byte for
  byte on what is valid.
- **Validation tooling** - reorg simulators, chain-scanning utilities.
  The repo's `examples/` ships a bare-bones silent payments scanner.
- **Fuzzing** consensus code from Rust: the repo has `block_roundtrip`,
  `chainman_process_block` and `script_verify` cargo-fuzz targets.

## Common pitfalls

- **The API is not stable.** The C header is unversioned and Core makes
  no compatibility promise; the Rust crate has had renames and signature
  changes at every minor (e.g. 0.3.0 renamed
  `ProcessBlockHeaderResult::Success`/`Failed` to `Valid`/`Invalid` and
  made `process_block_header` return a `Result`). Pin exact versions.
- **The vendored Core subtree is the real dependency.** Two builds of
  the same crate version against different subtree commits are different
  consensus engines. Check subtree movement with
  `./contrib/check_subtree_kernel_commits.sh` after a
  `git subtree pull`.
- **Not a node.** No P2P, so nothing feeds the chainstate for you; you
  supply blocks. No mempool acceptance and no policy RPCs.
- Upgrade past 0.3.0 if you use `ChainstateManager::get_block_tree_entry`
  - before that release it passed the wrong pointer to the kernel and
  returned `None` for every input.
- Bitcoin Core release binaries do not ship the library, so there is no
  system package to link against; you build it.

## See also

- [rust-bitcoin/SKILL.md](../rust-bitcoin/SKILL.md)
- [corepc/SKILL.md](../corepc/SKILL.md)
- [secp256k1-c/SKILL.md](../secp256k1-c/SKILL.md)
- [../../core/indexes/SKILL.md](../../core/indexes/SKILL.md)

Attribution

claude-dev-suiteclaude-dev-suite
View sourceSee grades on GitHubMore from claude-dev-suite →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →