Learn Bitcoin From the Command Line: Your First Steps With Bitcoin Core
Most people meet Bitcoin through an app: a balance, a send button, a green checkmark. That is convenient, but it hides the machinery. Learning Bitcoin from the command line is the honest way in. Nothing is prettified for you. You ask the node a question, and it answers with the real block height, real hashes, and real transactions. If you want to learn bitcoin and blockchain at the level where things actually happen, this is the place to start.
The two programs you are dealing with
Bitcoin Core is really two programs working together. The first is the node daemon: it talks to other nodes on the network, downloads and verifies blocks, and keeps the blockchain on your disk. The second is the command-line tool, bitcoin-cli, which is how you speak to that daemon. In a default install, they live side by side, so you do not need to hunt for them.
Think of the daemon as a librarian who has read every book, and bitcoin-cli as the short note you slide across the desk. You write the note, the librarian answers.
Your node versus someone else’s
When you run your own node, you are verifying the chain yourself rather than trusting a third party’s server. That is the whole point. But here is the good news for beginners: your first attempt does not need the full chain synced to be useful. Start the daemon, watch it sync, and learn what it is doing. The commands below will work and teach you something long before syncing finishes.
Your first five commands
Each of these answers a simple question, and each returns a recognisable shape:
getblockchaininfo— “What is the state of my chain?” The output is a JSON blob: named fields with values beside them. Read it slowly; it is a status report, not a puzzle.getblockcount— “How many blocks have I verified?” The output is a single number.getblockhash— “What is the hash of the block at this height?” You give it a height, it gives you a long hex string. That string is the block’s fingerprint.getblock— “Show me that block.” You give it a hash, and it returns a JSON blob containing the block’s height, its previous block hash, and the list of transactions inside it.getnewaddress— “Give me a fresh address.” The output is a short string. This is educational; do not send real money to it yet.
Reading a block
When you run getblock, look for three things. The height tells you where the block sits in the chain. The previous block hash is the long hex string linking it to the block before — this is the chain in “blockchain.” The transaction list is an array of entries, each one a transaction identifier. That is the whole structure: a block is a container with a height, a link backwards, and a bundle of transactions.
Reading a transaction
Take one of those transaction identifiers and run getrawtransaction. You will get raw data. Then run decoderawtransaction on it to get a readable JSON blob. Look for inputs (where the coins came from), outputs (where they went, and how much), the fee (the difference between them), and confirmations (how many blocks have been built on top since). You are now reading Bitcoin at the level of the protocol.
The habit that teaches you everything
Type help. It lists the commands available to you. Type help followed by a command name and it explains that command’s arguments. This is how you discover the next thing to learn, without a tutorial telling you what to do. The command line rewards curiosity.
When a command returns an error
Errors are information, not failure. Read the message first — it usually names the problem. Then check that the daemon is actually running; if it is not, nothing will answer. Finally, check that you are quoting the right argument, especially hashes and addresses, which must be exact. A missing character is a different question entirely.
A sane stopping point for week one
You are done for now when you can follow a transaction from block to block and explain what a hash is in your own words. That is a real milestone. You have seen the machinery.
You do not need to know yet
- Mining hardware and how mining works in detail.
- Wallets holding real money.
- Trading, prices, or market movements.
All of the commands above run against your own node. This is educational material, not financial advice. Take your time, and let the command line teach you at its own pace.