EN
ENNA

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
Official Documentation
1

Install Bitcoin Core

Download and install Bitcoin Core which includes both the daemon (bitcoind) and the CLI tool (bitcoin-cli).

macOS

brew install bitcoin

Ubuntu

sudo apt install snapd && sudo snap install bitcoin-core

Verify

bitcoin-cli --version
2

Start the Daemon

Start bitcoind to begin syncing the blockchain. First sync takes a long time.

Start daemon

bitcoind -daemon

Check sync progress

bitcoin-cli getblockchaininfo | grep verificationprogress

Note: 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.

3

Query Blockchain Info

Once synced, query blocks, transactions, and network info.

Current block height

bitcoin-cli getblockcount

Network info

bitcoin-cli getnetworkinfo

Get a block hash

bitcoin-cli getblockhash 800000

Get block details

bitcoin-cli getblock $(bitcoin-cli getblockhash 800000)
4

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> true

Decode 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).

5

Wallet Operations (for Testing)

Create a wallet and generate addresses for testing and research.

Create wallet

bitcoin-cli createwallet "research"

Generate address

bitcoin-cli getnewaddress

List wallets

bitcoin-cli listwallets

Note: 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.

Back to Bitcoin Core CLIFull Documentation