Skip to content

Bitcoin

Endpointhttps://rpc.lab.au.ro/btc
Protocolbitcoind JSON-RPC over HTTPS (POST)
Networkmainnet
Batch

No node credentials

With raw bitcoind you'd need rpcuser/rpcpassword. Here the gateway injects node auth for you — your apikey header is the only credential. Traffic is load-balanced across multiple Bitcoin nodes.

Supported methods

Live-verified: getblockchaininfo, getblockcount, getbestblockhash, getblockhash, getblock, getblockheader, getrawtransaction, getnetworkinfo, getmempoolinfo, getmininginfo, estimatesmartfee, sendrawtransaction — the standard public bitcoind surface. Wallet RPCs (getbalance, sendtoaddress, …) are not available: nodes run without wallets; track addresses client-side and sign offline.

Quick test

bash
curl -X POST https://rpc.lab.au.ro/btc \
  -H "apikey: $YOUR_API_KEY" -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"1.0","id":1,"method":"getblockchaininfo","params":[]}'
# {"jsonrpc":"2.0","result":{"chain":"main","blocks":953381,"headers":953381,...},"id":1}

SDK integration

bitcoind speaks plain JSON-RPC — a 10-line helper replaces a client library, and bitcoinjs-lib handles keys/transactions offline:

js
import * as bitcoin from 'bitcoinjs-lib'

async function btc(method, params = []) {
  const res = await fetch('https://rpc.lab.au.ro/btc', {
    method: 'POST',
    headers: { apikey: process.env.YOUR_API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ jsonrpc: '1.0', id: 'app', method, params })
  })
  const { result, error } = await res.json()
  if (error) throw new Error(`${error.code}: ${error.message}`)
  return result
}

console.log('height:', await btc('getblockcount'))           // 953381
const hash = await btc('getblockhash', [840000])
const header = await btc('getblockheader', [hash])           // halving block, 2024-04-20
const fee = await btc('estimatesmartfee', [6])               // { feerate: 0.00001017, blocks: 6 }

Recipes

Fee estimation

js
const { feerate } = await btc('estimatesmartfee', [6])   // BTC per kvB
const satPerVb = Math.ceil(feerate * 1e8 / 1000)

Inspect a transaction

js
const tx = await btc('getrawtransaction', [txid, true])   // verbose decode
// confirmed txs are cached indefinitely — repeat lookups are instant

Build & broadcast (offline signing)

js
const psbt = new bitcoin.Psbt({ network: bitcoin.networks.bitcoin })
psbt.addInput({ hash: utxo.txid, index: utxo.vout, witnessUtxo: { script, value } })
psbt.addOutput({ address: destination, value: amount })
// ...sign with your key material (ecpair / hardware wallet)...
// psbt.finalizeAllInputs()
const txid = await btc('sendrawtransaction', [psbt.extractTransaction().toHex()])

sendrawtransaction costs 20 CU, is never cached, and the node validates before relay — malformed transactions return {"code":-22,"message":"TX decode failed"}.

Live height for monitoring

getblockcount is cached 10 s. For an uncached probe use getmininginfo (never cached) — handy in smoke tests.

Limitations

  • No wallet RPCs, no address-index queries (getrawtransaction needs the txid; for address history use your own indexer or scan blocks).
  • getrawtransaction for unconfirmed/unknown txids returns error -5.