THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin Core RPC Authentication: Cookie Files, rpcauth, and Network Security

permalink THAMER
#bitcoin-core-rpcauth#rpc-cookie#rpcallowip#rpcbind#security

Bitcoin Core RPC authentication controls access to powerful node and wallet operations. Because some methods can spend funds or change configuration-dependent state, RPC should be treated as a privileged administration interface.

Cookie authentication

When no explicit RPC username/password configuration is used, Bitcoin Core can create a temporary authentication cookie in its data directory. A local client reads that file and uses its contents for HTTP Basic authentication. The cookie is rotated across restarts and should be protected by operating-system file permissions.

For example, bitcoin-cli can use the cookie automatically when running with the appropriate data-directory access. Applications should avoid copying cookies into public directories, containers without access controls, or logs.

rpcauth authentication

The rpcauth configuration mechanism stores a salted verifier rather than a reusable plaintext RPC password in bitcoin.conf. The client still needs the corresponding username and password, and the connection must be protected against interception. rpcauth is not encryption of the RPC transport.

Bitcoin Core includes an rpcauth.py helper for generating configuration entries. Generate credentials using trusted tooling and use distinct credentials for distinct trust boundaries where feasible.

Binding and access control

rpcbind selects the interface(s) on which the RPC server listens; rpcallowip controls permitted source IP ranges. Neither is a substitute for authentication. Do not bind RPC to a publicly reachable interface merely to make remote access convenient.

Prefer local loopback or a protected Unix socket where supported, and use a secured tunnel or private authenticated network for remote administration. If HTTP RPC crosses a network, protect the transport because Basic authentication does not encrypt credentials.

Operational pitfalls

Protect configuration files, authentication cookies, wallet files, and backups. Restrict access to the data directory. Keep secrets out of process listings, command histories, crash reports, and monitoring output. Distinguish the node P2P port from the RPC port: opening a P2P listener does not imply RPC should be reachable.

Primary references

Bitcoin Core authentication documentation: https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md

Bitcoin Core configuration reference: https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf

Bitcoin Core rpcauth helper: https://github.com/bitcoin/bitcoin/blob/master/share/rpcauth/rpcauth.py

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects