I run knots + mine with ocean using datum

This is a direction I've been exploring too — but with a slightly different angle.

There've been attempts before (btcd in Go, bcoin in JS, etc.) to “extract” or reimplement Bitcoin’s consensus logic, but they end up rewriting everything — which risks subtle consensus drift.

My proposal:

I’ve been thinking about a clean separation inside Core — breaking it into:

- a Consensus layer (shared .so lib, minimal C API)

- and a Node layer (networking, mempool, wallet, RPC, etc.)

Extract Core’s consensus rules as-is into a shared .so lib with a minimal C interface — no networking, no mempool, just pure validation logic (script checks, rule enforcement, etc.).

Then have everything else — blockchain DB, UTXO set, P2P, wallet, mempool, etc. — live in a modular node layer that links against the consensus lib.

Why this is different:

✅ No reimplementation — the logic is still Core’s, just exposed cleanly

🧩 Usable from Python/Rust/etc. via FFI, or over RPC

🔍 Easier to test, audit, sandbox

🌱 Node runners could experiment with custom node layers, while sharing the same validation engine

I’ve prototyped a wrapper exposing:

int validate_block(const uint8_t* data, size_t len, char* err_buf, size_t err_len);

Would love to hear if others are thinking about modularization like this — or see tradeoffs I’m missing.

Reply to this note

Please Login to reply.

Discussion

No replies yet.