Runnable testnet recipes in Node (18+, uses built-in fetch and ES modules). See the
top-level README for the full recipe list and how each maps to a
TestnetHub guide.
Only recipes 00, 08, 14, and 15 (offline key generation, transaction building, writing an OP_RETURN message, and deriving address types) need libraries; the rest use built-in fetch or RPC and need no install:
npm install # bitcoinjs-lib, ecpair, tiny-secp256k1 (for recipes 00, 08, 14, and 15)node 00_new_key.js # a fresh key + address (needs npm install)
node 01_tip_height.js # current block height (no node)
node 02_address.js [address] # balance + UTXOs (no node)
node 03_fees.js # fee estimates (no node)
node 04_mempool.js # mempool summary (no node)
node 05_broadcast.js <signed-hex># broadcast a signed tx (no node)
node 06_watch.js <txid> [confs] # poll until confirmed (no node)
node 07_node_rpc.js # needs RPC_USER/RPC_PASS + a node
node 08_build_and_send.js <wif><addr><sats># offline signing, needs `npm install`
node 09_monero_info.js # needs monerod --stagenet
node 10_decode_tx.js <txid># decode + draw a transaction (no node)
node 11_block.js [height] # fetch + draw a block (no node)
node 12_monero_block.js [height] # Monero block/tx, amounts hidden (needs monerod)
node 13_monero_wallet.js # Monero wallet address + balance (needs monero-wallet-rpc)
node 14_op_return.js <wif>"your message"# write a message on-chain (needs npm install)
node 15_address_types.js [wif] # Legacy/SegWit/Taproot from one key (offline, needs npm install)config.js reads everything from environment variables; the defaults are shown below:
| Var | Used by | Default |
|---|---|---|
TESTNET_API | 01-06, 08, 10, 11, 14 | https://testnetscan.com |
TESTNET_NET | 01-06, 10, 11 | btc-testnet4 (or ltc-testnet) |
RPC_URL / RPC_USER / RPC_PASS | 07 | http://127.0.0.1:19332 (Litecoin testnet; Bitcoin testnet4 is :48332) |
MONEROD | 09, 12 | http://127.0.0.1:38081 |
MONERO_WALLET_RPC | 13 | http://127.0.0.1:38083 |
Recipes 01-06 hit TestnetScan's public API. Get coins to play with from CypherFaucet.