/** * Bitcoin Core RPC Client * * COPYRIGHT 2026 Flying Whale — zaghmout.btc | ERC-8004 #54 | ALL RIGHTS RESERVED * Flying Whale Proprietary License v3.0 — Agreement-First Policy * Owner: SP322ZK4VXT3KGDT9YQANN9R28SCT02MZ97Y24BRW * * ══════════════════════════════════════════════════════════════════════ * SOVEREIGNTY LAYER — Bitcoin Core Direct RPC * ══════════════════════════════════════════════════════════════════════ * * "Don't trust, verify." — Satoshi Nakamoto * * Connects directly to a local or remote Bitcoin Core node via JSON-RPC. * Eliminates dependency on mempool.space — you ARE the network. * * Environment variables: * BTC_CORE_HOST — RPC host (default: 127.0.0.1) * BTC_CORE_PORT — RPC port (default: 8332 mainnet / 18332 testnet) * BTC_CORE_USER — RPC username (default: bitcoin) * BTC_CORE_PASSWORD — RPC password (required if node is configured) * BTC_CORE_WALLET — wallet name for wallet RPC calls (optional) * * bitcoin.conf example (Pruned mode — only ~10GB disk): * server=1 * prune=5500 * rpcuser=bitcoin * rpcpassword=your_strong_password * rpcallowip=127.0.0.1 * rpcbind=127.0.0.1 * * Full node (600GB+ disk — maximum sovereignty): * server=1 * txindex=1 * rpcuser=bitcoin * rpcpassword=your_strong_password */ import type { Network } from "../config/networks.js"; import type { UTXO, FeeEstimates, MempoolStats } from "./mempool-api.js"; export interface BitcoinCoreConfig { host: string; port: number; user: string; password: string; wallet?: string; network: Network; } export declare function getBitcoinCoreConfig(network: Network): BitcoinCoreConfig; /** * Returns true if Bitcoin Core is configured (BTC_CORE_PASSWORD is set). * Used to decide whether to use Core or fall back to mempool.space. */ export declare function isBitcoinCoreConfigured(): boolean; export declare class BitcoinCoreClient { private readonly config; private readonly baseUrl; private readonly authHeader; constructor(config: BitcoinCoreConfig); rpc(method: string, params?: unknown[]): Promise; /** * Check if Bitcoin Core node is reachable and synced. */ getNodeInfo(): Promise<{ online: boolean; chain: string; blocks: number; synced: boolean; syncPct: number; pruned: boolean; version: string; peers: number; }>; /** * Get UTXOs for a Bitcoin address using scantxoutset. * Works on both full nodes and pruned nodes. * Returns data in the same format as MempoolApi.getUtxos(). */ getUtxos(address: string): Promise; /** * Get fee estimates from Bitcoin Core's smart fee estimator. * Uses estimatesmartfee for 1, 3, 6, and 144 block targets. * Returns data in the same format as MempoolApi.getFeeEstimates(). */ getFeeEstimates(): Promise; /** * Get total balance for a Bitcoin address (confirmed + unconfirmed). * Scans UTXO set — works on pruned nodes. */ getBalance(address: string): Promise<{ confirmed: number; unconfirmed: number; total: number; }>; /** * Get mempool statistics from your own node. * Returns data in the same format as MempoolApi.getMempoolInfo(). */ getMempoolInfo(): Promise; /** * Get raw transaction details. * Requires txindex=1 on full node, or transaction must be in mempool. */ getTransaction(txid: string): Promise<{ txid: string; confirmed: boolean; blockHeight?: number; blockTime?: number; confirmations: number; size: number; fee?: number; }>; /** * Broadcast a signed raw transaction directly to the Bitcoin network. * "Don't trust, verify." — you broadcast to YOUR node, your node * relays to the network. No third-party API needed. * * @param rawTx — hex-encoded signed transaction * @returns txid */ broadcastTransaction(rawTx: string): Promise; private _getBlockHeight; } export declare function getBitcoinCoreClient(network: Network): BitcoinCoreClient; //# sourceMappingURL=bitcoin-core.d.ts.map