Bitcoin Node Deployment
Your own Bitcoin node is needed when you need independence from third parties. Public APIs (Blockstream, BlockCypher) are convenient, but: rate limits, downtime, inability to make certain RPC calls, privacy (all your addresses visible to provider). For a production payment acceptance system or custodial service — your own node is mandatory.
Hardware Requirements
| Mode | Disk | RAM | CPU | Description |
|---|---|---|---|---|
| Pruned | 10–15 GB | 2 GB | 2 cores | Stores only UTXO set + last N blocks |
| Full | 650+ GB | 4 GB | 4 cores | Full transaction history |
| Full + Electrum (Fulcrum) | 1 TB+ | 8 GB | 4+ cores | For wallets and address lookup |
SSD is mandatory — HDD makes initial block download 3–5x slower due to random reads during UTXO set verification.
Bitcoin Core Installation
# Ubuntu 22.04
wget https://bitcoincore.org/bin/bitcoin-core-27.0/bitcoin-27.0-x86_64-linux-gnu.tar.gz
# Always verify signature!
wget https://bitcoincore.org/bin/bitcoin-core-27.0/SHA256SUMS
wget https://bitcoincore.org/bin/bitcoin-core-27.0/SHA256SUMS.asc
gpg --recv-keys 152812300785C96444D3334D17565732E08E52E
gpg --verify SHA256SUMS.asc SHA256SUMS
sha256sum --check SHA256SUMS --ignore-missing
tar xzf bitcoin-27.0-x86_64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-27.0/bin/*
Configuration ~/.bitcoin/bitcoin.conf:
# Main
server=1
daemon=1
txindex=1 # Index all transactions (needed for lookupByTxId)
# RPC
rpcuser=bitcoinrpc
rpcpassword=STRONG_RANDOM_PASSWORD_HERE
rpcbind=127.0.0.1
rpcallowip=127.0.0.1
# ZMQ — for real-time notifications
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
zmqpubhashblock=tcp://127.0.0.1:28334
# Performance
dbcache=1000 # Cache for initial sync, MB
maxmempool=500 # Mempool size, MB
# For pruned mode (remove txindex):
# prune=10000 # Store 10 GB of blocks
txindex=1 — critical if you need to search transactions by hash. Without it — only current UTXO. Enabling retroactively requires full reindex (bitcoind -reindex).
Initial Block Download
IBD on mainnet takes 1–5 days on SSD depending on hardware. Acceleration:
# Run with increased cache for IBD
bitcoind -dbcache=4000 -daemon
# Monitor progress
bitcoin-cli getblockchaininfo | jq '.verificationprogress'
# 0.0 → 1.0 (100%)
# How much left
bitcoin-cli getnetworkinfo | jq '.connections'
ZMQ for Real-Time
Polling via RPC every few seconds is primitive. ZMQ gives push notifications:
import * as zmq from 'zeromq';
const blockSocket = new zmq.Subscriber();
const txSocket = new zmq.Subscriber();
blockSocket.connect('tcp://127.0.0.1:28334');
blockSocket.subscribe('hashblock');
txSocket.connect('tcp://127.0.0.1:28333');
txSocket.subscribe('rawtx');
// New block
for await (const [topic, message] of blockSocket) {
const blockHash = message.toString('hex');
console.log('New block:', blockHash);
await processNewBlock(blockHash);
}
// New transaction in mempool
for await (const [topic, rawTx] of txSocket) {
const tx = bitcoin.Transaction.fromBuffer(rawTx);
await processPendingTransaction(tx);
}
Basic RPC Calls
import * as Client from 'bitcoin-core';
const client = new Client({
host: '127.0.0.1',
port: 8332,
username: 'bitcoinrpc',
password: process.env.BITCOIN_RPC_PASSWORD!,
});
// Transaction info
const tx = await client.getRawTransaction(txHash, true);
// UTXO info
const utxo = await client.getTxOut(txHash, outputIndex);
// Create new address (for HD wallet better use bitcoinjs-lib)
const address = await client.getNewAddress('payment_label', 'bech32');
// Current fee rate (sat/vB for next block)
const feeRate = await client.estimateSmartFee(1);
// feeRate.feerate in BTC/kB, convert to sat/vB:
const satPerVbyte = Math.ceil(feeRate.feerate * 100_000);
Security
RPC port (8332) never expose to outside. Access only via localhost or VPN:
# Firewall: close RPC from outside
ufw deny 8332
ufw allow 8333 # P2P port — must be open for sync
# Systemd unit for autostart
cat > /etc/systemd/system/bitcoind.service << EOF
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
User=bitcoin
ExecStart=/usr/local/bin/bitcoind -conf=/home/bitcoin/.bitcoin/bitcoin.conf
Restart=on-failure
TimeoutStartSec=infinity
[Install]
WantedBy=multi-user.target
EOF
systemctl enable bitcoind
systemctl start bitcoind
Separate system user bitcoin without sudo — standard practice. Wallet files in /home/bitcoin/.bitcoin/wallets/ with backup of seed.







