Configure Bitcoin Core
Configure Bitcoin Core before starting your node.
Last updated
Was this helpful?
Configure Bitcoin Core before starting your node.
Last updated
Was this helpful?
Let's create the needed files:
Add the following configuration to the bitcoin.conf
file we just created:
With the configuration below the node will be accessible only on localhost and on the Tor network. Refer to if you wish to also expose your node via IPv4/IPv6.
Bitcoin provides a control interface via a JSON-RPC API on port 8332. We enabled with server=1
in the bitcoin.conf
file.
Other locally running applications that need to interact with Bitcoin's JSON-RPC API will use the cookie located at ~/.bitcoin/.cookie
.
If you ever want to connect remotely running applications to the JSON-RPC API, you can create a set of credentials with the command below:
Verify the output and append the mentioned line to the bottom of the bitcoin.conf
file.
Save the plain text password securely because the line added to bitcoin.conf
contains only the hash.
Bitcoin Core and other applications you install will heavily rely on Tor to connect with peers and ensure our wallets remain accessible. Proper configuration is critical.
Edit the configuration file:
Add the following lines:
SocksPort ⇒ SOCKS proxy, routes traffic through the Tor network
ControlPort ⇒ Allows other programs to interact with the Tor daemon
CookieAuthentication ⇒ Requires local cookie authentication to access the control port (/run/tor/control.authcookie)
CookieAuthFileGroupReadable ⇒ Only users in the debian-tor
group can authenticate with the cookie
Exposing the RPC API is not recommended unless you fully understand the risks. It is a prime target for brute-force attacks and zero-day exploits. If compromised, an attacker could steal your Bitcoin.
Bitcoin Core's main program is bitcoind
(short for Bitcoin Daemon). We will configure it as a systemd
service to simplify management:
Add the following:
In User=, replace your_user with your own user
Do the same in the path of PIDFile=
Verify the path of ExecStart= by running the command which bitcoind
Finally, reload systemd:
As configured, the JSON-RPC API is accessible only from localhost. To expose this port externally, you can , but as mentioned above it's not recommended.