Native Node.js block template, blob, and merged-mining bindings for MoneroOcean-style pool tooling.
node-blocktemplate is a native addon for Node.js that focuses on multichain block template handling for pool backends and related infrastructure.
It provides:
- native block blob conversion and block ID helpers for Cryptonote-family templates
- merged-mining parent and child block construction helpers
- address prefix decoding helpers
- JavaScript-side helpers for Raven, RTM, KCN, Dero, ETH, and ERG-oriented template handling
The current test suite covers active conversion vectors for ARQ, BLOC, IRD, MSR, RYO, SAL, TUBE, XEQ, XHV, XLA, XMR, XMV, XTNC, and ZEPH, plus RTM coinbase handling.
From GitHub:
npm install https://github.com/MoneroOcean/node-blocktemplateFor local development:
npm install
npm testBuild notes
- Node.js
>=18- Linux and macOS are the intended CI platforms
- The addon builds locally with
node-gyp, so you need Python 3,make, and a working C/C++ toolchain- Boost headers,
boost_date_time, andlibsodiumheaders are required- Non-ARM builds use
-march=native, so build on the target CPU class or inside a compatible build image- No prebuilt binaries are shipped in this repository
const blocktemplate = require("node-blocktemplate");
const converted = blocktemplate.convert_blob(Buffer.from(blockHex, "hex"), 0);
const blockId = blocktemplate.get_block_id(Buffer.from(blockHex, "hex"), 15);
const ravenJob = blocktemplate.RavenBlockTemplate(rpcData, poolAddress);
const nextRtmBlob = blocktemplate.constructNewRtmBlob(
Buffer.from(rtmTemplateHex, "hex"),
nonceBuffer
);Exact, vector-backed usage examples live in tests/test.js.
| Method | Returns | Notes |
|---|---|---|
convert_blob(blockBuffer, blobType?) |
Buffer |
Converts a block template into the hashing blob used by miners. |
construct_block_blob(templateBuffer, nonceBuffer, blobType?, cycle?) |
Buffer |
Reconstructs a solved block blob from a template and nonce. |
get_block_id(blockBuffer, blobType?) |
Buffer |
Returns the 32-byte block ID. |
address_decode(addressBuffer) |
number or Buffer |
Returns the address prefix when the payload parses cleanly, otherwise the decoded raw payload. |
address_decode_integrated(addressBuffer) |
number or Buffer |
Integrated-address variant of address_decode. |
get_merged_mining_nonce_size() |
number |
Returns the merged-mining extra nonce size expected by the native helpers. |
construct_mm_parent_block_blob(parentTemplate, blobType, childTemplate) |
Buffer |
Injects merged-mining data into a parent block template. |
construct_mm_child_block_blob(parentShare, blobType, childTemplate) |
Buffer |
Builds the merged-mined child block blob from the solved parent share. |
| Method | Returns | Notes |
|---|---|---|
baseDiff() |
BigInt-like value |
Shared base difficulty helper. |
baseRavenDiff() |
number |
Raven-specific base difficulty constant. |
RavenBlockTemplate(rpcData, poolAddress) |
object |
Builds a Raven/KawPow-oriented blocktemplate payload. |
blockHashBuff(headerBuffer) |
Buffer |
Double-SHA256 hash helper with pool-oriented byte order. |
blockHashBuff3(headerBuffer) |
Buffer |
Double-SHA3-256 variant used by KCN helpers. |
convertRavenBlob(blobBuffer) |
Buffer |
Returns the hashable Raven header. |
constructNewRavenBlob(templateBuffer, nonceBuffer, mixHashBuffer) |
Buffer |
Updates a Raven template with nonce and mix hash. |
constructNewDeroBlob(templateBuffer, nonceBuffer) |
Buffer |
Inserts the Dero nonce into the expected position. |
EthBlockTemplate(rpcData) |
object |
Formats ETH-family RPC data into pool-facing metadata. |
ErgBlockTemplate(rpcData) |
object |
Formats ERG RPC data into pool-facing metadata. |
RtmBlockTemplate(rpcData, poolAddress) |
object |
Builds RTM/Ghostrider-oriented template metadata. |
convertRtmBlob(blobBuffer) |
Buffer |
Returns the RTM hashable header. |
convertKcnBlob(blobBuffer) |
Buffer |
Returns the KCN hashable header. |
constructNewRtmBlob(templateBuffer, nonceBuffer) |
Buffer |
Updates an RTM block template with a nonce. |
constructNewKcnBlob(templateBuffer, nonceBuffer) |
Buffer |
Updates a KCN block template with a nonce. |
- Cryptonote-family blob conversion and solved-block reconstruction through the native addon
- Forknote-style merged-mining parent and child block assembly
- Prefix decoding for standard and integrated Cryptonote-family addresses
- JavaScript helpers for Raven/KawPow, RTM/Ghostrider, KCN, Dero, ETH, and ERG pool integration
This repository is a utility layer for pool software and infrastructure. It is not a full miner and does not ship standalone CLI tooling.
| Command | What it does |
|---|---|
npm test |
Runs the active blob conversion and RTM handling suite. This is the path used in GitHub Actions. |
GitHub Actions runs the fast suite only, on Linux and macOS, with the same small Node matrix shape used by node-pow-hashing: Node 18, Node 24, and the runner's system Node where useful.
- MoneroOcean for the long-running maintenance branch, multi-chain pool support, and most of the current repository direction
- Lucas Jones /
lucasfor the original addon and early block/blob plumbing that the project still builds on clintarfor early follow-up maintenance and project evolutionCliffordSTfor utility and chain-support updates in the repository historycampurro/Campurrofor continued maintenance and fixesSome Random Crypto Guyfor support and maintenance work in the current-era historywallet42for feature and upkeep contributionsNeil Cogginsfor maintenance and fix-up work- ZephyrProtocol for Zephyr-specific support in the repo history
xmvdevfor MoneroV-related support in the repository historyGhost-ai-cpufor follow-up maintenance contributions