Native Bitcoin Core kernel
Uses the libbitcoinkernel C API instead of reimplementing consensus parsing and validation logic in JavaScript.
Parse, inspect, and validate Bitcoin blocks, transactions, scripts, and chainstate through libbitcoinkernel.
Experimental software
js-bitcoinkernel is experimental. Do not use it for consensus-critical applications, mainnet funds, custody, wallets, or systems where an incorrect validation result could cause financial loss.
js-bitcoinkernel is a TypeScript wrapper around Bitcoin Core's libbitcoinkernel. It lets JavaScript programs load the native kernel library and work with Bitcoin consensus objects without directly handling C pointers.
At a high level, the package gives you:
Block.check(...).ChainstateManager.| Layer | Description |
|---|---|
| Application code | Entry point |
| TypeScript public API | Exposed interface |
| Pointer lifecycle wrappers | Manages memory / pointers |
| FFI bindings (Koffi) | Bridge to native C++ |
| libbitcoinkernel | Bitcoin native logic layer |
| Bitcoin Core consensus engine | Rule validation engine |
import {
BlockHeader,
ChainParameters,
ChainType,
} from "js-bitcoinkernel";
const headerHex =
"010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e857233e0e61bc6649ffff001d01e36299";
const header = BlockHeader.fromBytes(Buffer.from(headerHex, "hex"));
const params = new ChainParameters(ChainType.MAINNET);
console.log(header.blockHash.toString());
console.log(params.consensusParams.toString());Start with the Introduction, review the Repository Analysis if you want the source-level map, then move into the Quick Start and API Overview.