Bitcoin CLI Commands: Ultimate Guide 2026

Bitcoin CLI Commands: Ultimate Guide 2026

Your node is synced. bitcoind is running. The wallet may be loaded, or maybe you disabled wallet support and only care about validation and network behavior. Either way, the next question is the same: how do you talk to the node without clicking through a GUI?

That's where Bitcoin Core CLI commands matter. Users often begin with a handful of examples copied from docs or old forum posts, then hit the usual friction points. A command works on one machine but not inside a container. A wallet RPC fails because it wasn't routed to the right wallet. A fee argument looks valid, but it uses a different unit than the command next to it. The syntax isn't usually the hard part. The operational context is.

This guide treats bitcoin-cli the way node operators and developers use it: as a direct administration and scripting layer over Bitcoin Core. It focuses on what holds up in daily use, what breaks, and which habits keep command-line work safe and predictable.

Table of Contents

Introduction to the Bitcoin Command Line Interface

A common failure starts like this. bitcoind is running, the node looks healthy, and bitcoin-cli still throws an RPC error right when you need to inspect mempool state or move a wallet workflow forward. In practice, bitcoin-cli is a control surface for a running Bitcoin Core node. It sends RPC requests to the server you configured, with whatever wallet, datadir, network, and credentials your environment points it at.

Introduction to the Bitcoin Command Line Interface

That operating model matters because the failure domain is wider than the binary itself. Problems usually come from the target node, RPC auth, a wrong -datadir, a missing -rpcwallet, or an operator talking to the wrong instance in a container or VM. I see this often with mixed environments where one shell targets mainnet on the host and another targets regtest inside Docker. The command succeeds. It just succeeds against the wrong node.

The CLI also invites a subtle automation mistake. Convenience output is useful for a quick human check, but not every summary command is safe to treat as one coherent snapshot. If a command combines multiple RPC calls under the hood, fields can reflect slightly different moments in time. That is fine for ad hoc checks at the terminal. It is a poor assumption for alerting, accounting, or scripts that decide whether to broadcast, bump fees, or rotate wallet state.

Use bitcoin-cli accordingly. Query specific RPCs when the result drives money movement, fee selection, or monitoring logic. That is where the gap shows between a simple command list and real operations.

Security starts here too. Anyone using the CLI regularly ends up handling RPC credentials, wallet names, shell history, and environment-specific flags. Those are not side issues. They affect whether your node is merely scriptable or exposed. If you want cleaner secret handling around shell-based Bitcoin operations, tools built for encrypted vault CLI access can fit well into that workflow. For more operator-focused writing on Bitcoin and adjacent infrastructure, the Cascoin blog on crypto tooling and node operations is worth keeping in your reading stack.

Getting Started with Your First Commands

The first job is mundane but important. Find the actual bitcoin-cli binary that matches the bitcoind instance you intend to control. On a local install that may be straightforward. On packaged systems, custom builds, or Docker-based setups, the binary can live in a different path than you expect.

If a command fails immediately, don't assume the RPC is broken. Confirm you're calling the right executable in the right environment. A common mistake is running a host-installed bitcoin-cli against a node that only exists inside a container, or vice versa.

The command pattern is simple:

  • bitcoin-cli <command>
  • bitcoin-cli <command> <arg1> <arg2>
  • bitcoin-cli -named <command> key=value
  • bitcoin-cli -rpcwallet=<wallet_name> <wallet_command>

The built-in help system is still the fastest authoritative check for syntax on a live system. Use these two forms constantly:

  • List available commands: bitcoin-cli help
  • Inspect one command: bitcoin-cli help sendtoaddress

That second form matters more than many users realize. It tells you which arguments are positional, which are optional, and whether a parameter name has changed over time. When you're working across multiple systems or mixed Bitcoin Core versions, that saves real debugging time.

Don't memorize command signatures that you only use occasionally. Query the node you're actually operating.

A solid first-session sequence looks like this:

  1. Check general RPC connectivity with bitcoin-cli help.
  2. Inspect chain state with bitcoin-cli getblockchaininfo.
  3. Inspect network state with bitcoin-cli getnetworkinfo.
  4. If wallet is enabled, check wallet visibility with bitcoin-cli getwalletinfo.

If getwalletinfo errors, that doesn't necessarily mean your wallet is missing. It may mean no wallet is loaded, or you need to specify -rpcwallet for wallet-scoped RPCs. That wallet routing issue is one of the most common reasons a command that “should work” doesn't.

Essential Node Control Commands

Operators who use only a GUI tend to treat the node as a black box. bitcoin-cli gives you direct observability and a clean shutdown path. Those two things alone justify learning the core node commands early.

Start with the basics:

  • getblockchaininfo shows chain state and sync context.
  • getnetworkinfo shows network configuration and connectivity details.
  • stop asks the daemon to shut down cleanly.

If you only keep three commands in muscle memory, make it those three.

Reading health without overcomplicating it

getblockchaininfo is the command I reach for when someone says a node is “up” but can't answer whether it's usable. A daemon can be running while still catching up, still rescanning, or still operating in a state that makes wallet and indexing expectations wrong.

getnetworkinfo complements that by telling you whether the node is behaving like a network participant. If blockchain state looks fine but network behavior doesn't, that narrows your problem fast.

A practical operator habit is to check both before doing anything sensitive with wallet commands or scripted transaction handling.

Stop the daemon the right way

stop looks trivial, but it's one of the most important Bitcoin Core CLI commands in routine administration. It tells bitcoind to shut down gracefully rather than forcing process termination from outside. That matters for clean state transitions, especially when the node is handling wallet activity, indexes, or ongoing validation work.

Use stop before maintenance, before moving a datadir, and before container or service restarts when you can control the sequence.

Fast shutdown methods feel convenient until you're recovering from an avoidable dirty stop.

If you run multiple instances, be explicit about which one you're targeting. Ambiguity is the enemy here. The more instances, containers, or custom datadirs you manage, the less room there is for “default” behavior.

Complete Wallet Management Commands

Wallet work is where most command-line mistakes become expensive. The syntax isn't the primary issue. The primary issue is context. Which wallet is loaded, which wallet the RPC is targeting, and which fee unit the command expects.

Wallet lifecycle basics

For a fresh wallet, start with createwallet. For an existing one that isn't active in the current process, use loadwallet. Once loaded, generate a receiving address with getnewaddress. Then verify wallet state with getwalletinfo and available funds with getbalance.

Common wallet commands include:

  • createwallet for creating a new wallet in the node's wallet directory
  • loadwallet for making an existing wallet active
  • getnewaddress for deriving a fresh receiving address
  • getbalance for a simple balance check
  • getwalletinfo for a broader wallet status view

If you operate more than one wallet, stop relying on defaults. Use -rpcwallet deliberately. Many users lose time because they assume the CLI will “know” which wallet they meant. It won't.

A clean example looks like this:

  • bitcoin-cli -rpcwallet=ops getwalletinfo
  • bitcoin-cli -rpcwallet=ops getnewaddress

That's boring, and that's why it works.

Sending coins without fee confusion

sendtoaddress is one of the most familiar commands, and also one of the easiest to misuse. The biggest trap is fee handling. Bitcoin Core added explicit fee_rate support starting with v0.21, but the ecosystem still contains a mix of legacy fee settings in BTC/kvB and newer parameters in sat/vB, as discussed in Bitcoin Core review notes on fee_rate support.

That means you can't treat “fee rate” as one universal concept across every command or every old example you find online. You need to inspect the exact RPC help for the command you're using and verify the unit it expects on that version.

A few practical rules help:

  • Prefer explicit parameters: if the command supports fee_rate, use that rather than relying on vague defaults.
  • Check the unit every time: old examples and newer wallet RPCs may not express fees the same way.
  • Don't cargo-cult snippets: a command copied from an old blog post may still parse while encoding the wrong economic intent.

A transaction can be valid and still be priced badly. The CLI won't protect you from unit confusion.

When fee precision matters, I prefer named arguments where supported. They're easier to read in shell history and harder to misunderstand later.

UTXO inspection and backup hygiene

Before sending, listunspent is often more useful than getbalance. Balance is a summary. UTXOs tell you what the wallet can spend and how fragmented that spendability is.

That matters for:

  • Coin selection awareness: fragmented wallets behave differently from consolidated ones.
  • Manual transaction construction: you need concrete inputs, not just a total balance.
  • Operational review: if a wallet behaves oddly, the UTXO set often explains why.

For backup-oriented workflows, dumpwallet is a documented CLI example in the current man page. Treat any export operation as sensitive material handling. Don't leave dumps in casual shell environments, shared directories, or command histories you don't control.

If you only remember one wallet safety principle, make it this: wallet RPCs should happen in a controlled environment, with explicit wallet targeting, and with fee semantics checked against the live help output of the node you're using.

Advanced Blockchain Querying Commands

For developers, analysts, and operators debugging application behavior, the blockchain query side of bitcoin-cli is where the tool becomes much more than an admin interface. You can inspect blocks, raw transactions, and decoded transaction structure without depending on third-party explorers.

A practical block to transaction workflow

A standard chain inspection loop starts with a height. Use getblockhash to resolve that height to a block hash. Then call getblock with that hash to inspect the block contents, including the transaction identifiers it contains.

From there, move to transaction-level inspection:

  1. Resolve a height with getblockhash
  2. Fetch the block with getblock
  3. Select a transaction ID
  4. Fetch raw transaction data with getrawtransaction
  5. Decode for readability with decoderawtransaction

That sequence is simple, but it's the foundation for a lot of real work. If an app says it broadcast something but your accounting looks wrong, this is the path you take. If you're validating assumptions about script structure or output layout, same story.

For broader context on mining and block production environments around crypto infrastructure, Cascoin mining resources offer an additional perspective.

What to inspect when debugging data

Don't just decode and skim. Look for specific operational clues:

  • Inputs and outputs tell you whether the transaction shape matches what your wallet or application intended.
  • Locktime and sequence fields matter when you're dealing with replacement or timing-sensitive behavior.
  • Output values and script forms help explain why downstream logic accepted or rejected a transaction.

Plain hex from getrawtransaction is useful for reproducibility and low-level tooling. Decoded JSON from decoderawtransaction is where human review gets easier.

Some operators use blockchain explorers first and the CLI second. I do the opposite for anything that matters. Explorer views are convenient summaries. bitcoin-cli gives you data directly from the node you trust.

Network and Connection Commands

A Bitcoin node is only useful as a network participant if its peer layer is healthy. Most of the time, Bitcoin Core manages peer connections automatically. But when behavior looks odd, the network RPCs tell you whether the problem is local policy, peer quality, or simple lack of connectivity.

The first command to know is getpeerinfo. It gives you a detailed view of connected peers and is the fastest way to inspect the node's live network relationships.

What peer data is good for

Use getpeerinfo when you need to answer practical questions, not abstract ones:

  • Am I connected at all?
  • Do these peers look current and normal for this node's role?
  • Is one connection worth dropping during troubleshooting?

The management side is straightforward:

  • addnode manually requests connection behavior with a specific peer
  • disconnectnode severs an active connection
  • getpeerinfo shows who you're currently talking to

Manual peer management is useful in private test environments and during diagnosis. It's less useful as a routine “optimization” tool. Operators sometimes overmanage peers and create more confusion than they solve.

Peer commands are for visibility and targeted intervention, not for micromanaging a healthy node all day.

If your node can validate blocks and serve wallets locally but looks isolated from the broader network, start here before changing unrelated configuration.

Practical Workflows and Scripting Examples

You notice a test payment failed, the fee looks wrong, and the wallet sent change somewhere your script did not expect. That is where bitcoin-cli stops being a command reference and becomes an operations tool. Good workflows are less about memorizing RPC names and more about building repeatable sequences that are safe under pressure, easy to inspect, and hard to misuse.

Regtest is still the fastest place to build those habits. It lets you control block production, wallet state, and transaction flow without waiting on external infrastructure. The basic loop is familiar, but the operational details matter more than the command list.

Practical Workflows and Scripting Examples

A regtest loop that developers actually use

A usable regtest cycle usually starts with a clean assumption set. Know which chain you are on, which wallet you are targeting, and whether your script is allowed to create state or only inspect it. Mixing those concerns is how test helpers become production hazards later.

A practical loop looks like this:

  1. Start bitcoind in regtest mode.
  2. Create or load the wallet you intend to use.
  3. Derive a fresh address with getnewaddress.
  4. Mine spendable coins with generatetoaddress.
  5. Confirm wallet state with getbalances or listunspent.
  6. Build, fund, sign, and broadcast a transaction.
  7. Mine another block if you need fast confirmation for the next test step.

That sounds simple because it is. The part that trips people up is state management. Coinbase outputs on regtest still need maturity before they can be spent, wallet selection still matters, and scripts that assume one loaded wallet often break the moment a second wallet appears on the node.

For broader planning around Bitcoin infrastructure work, Cascoin's roadmap for node and tooling development shows the kind of public technical direction mature projects should communicate.

A short walkthrough helps before automating further:

Raw transaction workflow in practice

For scripted payment handling, the raw transaction path is usually:

  • createrawtransaction
  • fundrawtransaction
  • signrawtransactionwithwallet
  • sendrawtransaction

That sequence is common for a reason. It separates intent from funding policy. You define outputs first, then let the wallet choose inputs, add change, and estimate fees. After that, the wallet signs what it can, and only then do you broadcast.

The trade-off is clear. sendtoaddress is faster for ordinary wallet spending. Raw transaction RPCs give tighter control over outputs, replaceability, input choice, and fee behavior. They also expose more failure modes. A script can fund the wrong wallet, create unexpected change, or under-handle a partial signing result if you do not inspect each step.

In practice, fundrawtransaction deserves more attention than it gets in simple examples. Operators often accept its defaults in testing, then discover later that change placement, fee subtraction, or RBF settings were never explicit. If you care about predictable output structure, set those options on purpose and verify the funded transaction before signing.

A shell workflow that survives contact with production

The gap between a demo script and a reliable operator script is mostly about validation.

Use explicit wallet routing with -rpcwallet. Parse JSON with jq instead of grepping strings. Stop on errors. Log the txid, fee, selected inputs, and decoded final transaction if the script is doing anything you may need to audit later.

A small pattern goes a long way:

WALLET="ops-wallet"
ADDR=$(bitcoin-cli -regtest -rpcwallet="$WALLET" getnewaddress)
bitcoin-cli -regtest -rpcwallet="$WALLET" generatetoaddress 101 "$ADDR" >/dev/null

RAW=$(bitcoin-cli -regtest createrawtransaction '[]' "{\"bcrt1...\":0.10000000}")
FUNDED=$(bitcoin-cli -regtest -rpcwallet="$WALLET" fundrawtransaction "$RAW")
HEX=$(echo "$FUNDED" | jq -r '.hex')
SIGNED=$(bitcoin-cli -regtest -rpcwallet="$WALLET" signrawtransactionwithwallet "$HEX")
FINALHEX=$(echo "$SIGNED" | jq -r '.hex')
TXID=$(bitcoin-cli -regtest sendrawtransaction "$FINALHEX")

echo "broadcast txid: $TXID"

Even in regtest, I would not treat that as finished. Check .complete after signing. Decode the transaction before broadcast if output correctness matters. If your script is testing fee logic, capture the funded fee field and compare it against your expectation instead of trusting a blind send.

Scripting habits that prevent expensive mistakes

A few habits hold up well across regtest, signet, and mainnet:

  • Set chain flags explicitly in every command or wrapper.
  • Use -rpcwallet every time when wallet RPCs are involved.
  • Treat fee rate and change behavior as inputs, not defaults you will revisit later.
  • Fail hard on empty output or null JSON fields.
  • Decode and inspect transactions before broadcast when the script creates them.
  • Keep test scripts and production scripts separate at the repository and host level.

Operational security matters here too. If a script can create spends, it belongs on a host with restricted access, careful secret handling, and clear audit boundaries. A good server hardening checklist is useful if your node or automation runner is exposed to other users or services.

The CLI is good at automation, but reliable automation comes from narrow assumptions, explicit wallet targeting, and fee handling you can explain after the fact. That is the difference between a handy command collection and a workflow you can trust.

Security Best Practices for Using Bitcoin CLI

The official command reference tells you what a command does. It doesn't tell you how operators get hurt by using it carelessly. That gap is real. Bitcoin Core source context highlights recurring pitfalls around non-atomic output for certain commands, wallet-specific RPC routing via -rpcwallet, and targeting the correct bitcoind path, which is why production-ready CLI use often differs from simple examples in the Bitcoin Core source file for bitcoin-cli.

Security Best Practices for Using Bitcoin CLI

Protect the RPC surface first

If bitcoin-cli can reach your node, anyone with equivalent access and valid credentials may be able to issue the same RPCs. That makes the RPC interface part of your security boundary, not just a convenience layer.

A few practices matter immediately:

  • Use strong RPC authentication and keep those credentials out of casual shell history and shared scripts.
  • Restrict filesystem permissions on bitcoin.conf and wallet-related directories.
  • Separate operator accounts from system-wide administrative accounts whenever possible.
  • Keep the RPC interface private to the environment that needs it.

If you're already hardening the host around your node, a structured server hardening checklist is useful because Bitcoin mistakes often start as ordinary Linux or server hygiene failures.

Avoid the common operator mistakes

The mistakes that recur are usually simple:

Mistake Why it causes trouble Better habit
Using convenience output as a strict snapshot Some combined output can represent different moments in time Query the exact RPCs you need for automation
Forgetting -rpcwallet Wallet RPCs can hit the wrong context or fail outright Always target the intended wallet explicitly
Running commands against the wrong binary or container The CLI may talk to a different environment than the one you meant Verify path, instance, and datadir before sensitive actions
Running as root by default A small operational error has a much larger blast radius Use a dedicated service or operator account

Security with bitcoin-cli is mostly about reducing ambiguity. The more explicit your environment, wallet target, and authentication path are, the fewer dangerous surprises you get.

One more point matters in practice. Don't expose the RPC service beyond the environment that needs it. bitcoin-cli is powerful because it can administer the node directly. That same property makes careless exposure unacceptable.

Bitcoin CLI Quick Reference Cheatsheet

When you're in the terminal, you usually don't need theory. You need the right command fast. This cheatsheet is the compact version.

Common Bitcoin CLI commands

Category Command Description
Help bitcoin-cli help Lists available RPC commands
Help bitcoin-cli help sendtoaddress Shows syntax and arguments for one command
Node bitcoin-cli getblockchaininfo Returns chain and sync state
Node bitcoin-cli getnetworkinfo Returns network and version details
Node bitcoin-cli stop Shuts down bitcoind cleanly
Wallet bitcoin-cli createwallet <name> Creates a wallet
Wallet bitcoin-cli loadwallet <name> Loads an existing wallet
Wallet bitcoin-cli getwalletinfo Shows wallet status
Wallet bitcoin-cli getnewaddress Generates a new receiving address
Wallet bitcoin-cli getbalance Returns wallet balance
Wallet bitcoin-cli listunspent Lists spendable UTXOs
Wallet bitcoin-cli sendtoaddress <address> <amount> Sends bitcoin from wallet funds
Wallet bitcoin-cli dumpwallet <file> Exports wallet data to a file
Blockchain bitcoin-cli getblockhash <height> Resolves a block height to a hash
Blockchain bitcoin-cli getblock <hash> Returns block data
Blockchain bitcoin-cli getrawtransaction <txid> Returns raw transaction data
Blockchain bitcoin-cli decoderawtransaction <hex> Decodes raw transaction hex
Network bitcoin-cli getpeerinfo Lists connected peers
Network bitcoin-cli addnode <node> onetry Attempts a manual connection
Network bitcoin-cli disconnectnode <node> Drops a peer connection
Scripting bitcoin-cli createrawtransaction ... Creates an unsigned raw transaction
Scripting bitcoin-cli fundrawtransaction <hex> Adds inputs, change, and fees
Scripting bitcoin-cli signrawtransactionwithwallet <hex> Signs a raw transaction
Scripting bitcoin-cli sendrawtransaction <hex> Broadcasts a signed transaction

Keep this close, but still use help on the live node when argument details matter.

Troubleshooting Common Bitcoin CLI Errors

Most CLI errors fall into a few predictable buckets. The fastest fix comes from identifying which bucket you're in before changing random settings.

Connection and process errors

If you get a connection-related error, verify that bitcoind is running in the environment your bitcoin-cli is targeting. On systems with multiple installs, service wrappers, or containers, the wrong binary path is a common cause.

Also confirm that your command is using the expected datadir and authentication context. A working node in one environment doesn't help if the CLI is pointed somewhere else.

Parameter and syntax errors

“Invalid parameters” usually means one of three things:

  • The argument order is wrong
  • The argument type is wrong
  • The command signature differs from the example you copied

Use bitcoin-cli help [command] on the exact node you're operating. That is faster and safer than trusting old snippets from memory.

Wallet-specific failures

Wallet errors often come from context, not corruption. Typical causes include:

  • No wallet loaded
  • Wrong wallet targeted
  • Insufficient funds
  • A wallet RPC called without -rpcwallet when needed

If a wallet command fails, first ask whether the wallet is loaded and whether the CLI is routed to that wallet explicitly. Only after that should you suspect a deeper problem.

One practical habit solves a lot of pain: test a benign wallet command like getwalletinfo in the same wallet context before attempting a send or export operation.

Frequently Asked Questions

What's the difference between bitcoind and bitcoin-cli?

bitcoind is the server process. It validates, stores chain state, manages networking, and optionally manages wallets. bitcoin-cli is the client that sends RPC requests to that running server.

Can I use bitcoin-cli with Docker?

Yes, if the CLI is executed in a context that can reach the target bitcoind instance with the correct configuration and credentials. In practice, that often means running the CLI inside the same container environment or being very explicit about how the host-side command reaches the containerized node.

Why does a wallet command work on one machine but fail on another?

Usually because the wallet isn't loaded in that node, or the command isn't using the right wallet context. Multi-wallet setups are especially sensitive to this. Be explicit with -rpcwallet.

Can I use bitcoin-cli without running my own full node?

You can point an RPC client at a node you don't personally operate, but that changes the trust model. At that point you're trusting someone else's server for chain data, wallet handling, or both. For serious operational use, local control is the reason the tool is valuable.

Is -getinfo good enough for scripting?

It's fine for quick human inspection. It's a poor foundation for strict automation when you need coherent state assumptions. For scripts, call the specific RPCs you need.


If you care about open cryptocurrency infrastructure beyond Bitcoin Core operations, Cascoin is worth a look. It's an open-source project with an ecological, gamified mining model, public code, and a community-driven approach that should appeal to builders, auditors, and miners who want transparent systems rather than black boxes.