Getting Started Guide
How to Install and Use Bitcoin Core CLI
This guide covers installing Bitcoin Core, syncing the blockchain, and using bitcoin-cli to query transactions, blocks, and addresses.
Prerequisites
- -500GB+ free disk space for full blockchain sync
- -Linux or macOS
- -Patience - initial sync takes hours to days
Install Bitcoin Core
Download and install Bitcoin Core which includes both the daemon (bitcoind) and the CLI tool (bitcoin-cli).
macOS
brew install bitcoinUbuntu
sudo apt install snapd && sudo snap install bitcoin-coreVerify
bitcoin-cli --versionStart the Daemon
Start bitcoind to begin syncing the blockchain. First sync takes a long time.
Start daemon
bitcoind -daemonCheck sync progress
bitcoin-cli getblockchaininfo | grep verificationprogressNote: For investigations where you don't need the full blockchain locally, consider using -prune=10000 to keep only the most recent 10GB of blocks. Or use a public API for quick lookups.
Query Blockchain Info
Once synced, query blocks, transactions, and network info.
Current block height
bitcoin-cli getblockcountNetwork info
bitcoin-cli getnetworkinfoGet a block hash
bitcoin-cli getblockhash 800000Get block details
bitcoin-cli getblock $(bitcoin-cli getblockhash 800000)Look Up Transactions
Query specific transactions by their hash. This is the core of blockchain forensics - following the money.
Get raw transaction
bitcoin-cli getrawtransaction <txid> trueDecode raw transaction
bitcoin-cli decoderawtransaction <hex>Note: The 'true' parameter on getrawtransaction returns decoded JSON instead of raw hex. You need -txindex=1 in your bitcoin.conf to look up arbitrary transactions (not just ones in your wallet).
Wallet Operations (for Testing)
Create a wallet and generate addresses for testing and research.
Create wallet
bitcoin-cli createwallet "research"Generate address
bitcoin-cli getnewaddressList wallets
bitcoin-cli listwalletsNote: For forensic work you typically don't need a wallet - you're analyzing other people's transactions. But having a wallet is useful for understanding how the protocol works.