Difference between revisions of "Installing your own Bitcoin node"

From Bisq Wiki
Jump to navigation Jump to search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
It is best practice that any Bitcoin user installs his own node, to send and verify his own transactions; moreover, if you use Bisq consistently, you are strongly encouraged to do so, to make the bitcoin network operations much more stable, and especially reduce the risk of needing [[Resyncing_SPV_file|SPV resync]] on a wallet that contains many transactions. Even when a SPV resync is needed, it will be much painless if done while connected to your own node.
+
It is best practice that any Bitcoin user installs his own node, to send and verify his own transactions; moreover, if you use Bisq consistently, you are strongly encouraged to do so, as it will make the bitcoin network connection much more stable, and especially reduce the risk of needing [[Resyncing_SPV_file|SPV resync]] on a wallet that contains many transactions. Even when a SPV resync is needed, it will be much painless if done while connected to your own node.
  
 
__TOC__
 
__TOC__
Line 8: Line 8:
  
 
The following are viable hardware options to host the node:
 
The following are viable hardware options to host the node:
 +
* refurbished laptop with at least 8GB of RAM
 +
** pros: comes with display, keyboard, and basic storage (existing storage will need to be replaced or expanded), can run multiple services and act as a full fledged home server, has builtin UPS
 +
** cons: drains more power and is more expensive than a Raspberry Pi 3, takes up more space on your shelf
 
* dedicated Raspberry Pi 3
 
* dedicated Raspberry Pi 3
 
** pros: very small, low power, completely silent
 
** pros: very small, low power, completely silent
** cons: no builtin display, keyboard nor storage, needs more initial maintenance
+
** cons: no builtin display, keyboard nor storage, very low performance, needs more initial maintenance
* refurbished laptop with at least 8GB of RAM
 
** pros: comes with display, keyboard, and basic storage (existing storage will need to be replaced or expanded), can run other services and act as a full fledged home server, has builtin UPS
 
** cons: drains more power and is more expensive than a Raspberry Pi 3, takes up more space on your shelf
 
 
* your daily driver machine
 
* your daily driver machine
 
** pros: no need to source additional hardware (except the additional storage if it's not enough), will likely not suffer from the limited additional overhead of a Bitcoin node while you use it normally
 
** pros: no need to source additional hardware (except the additional storage if it's not enough), will likely not suffer from the limited additional overhead of a Bitcoin node while you use it normally
Line 28: Line 28:
 
== Systems with command line interface ==
 
== Systems with command line interface ==
  
You may choose to run a dedicated refurbished laptop on Linux and without a desktop environment, and it would be a wise choice; regarding a Raspberry, while you could install a graphical desktop environment on a Pi 3, it is absolutely not recommended to do so, because it will be a self-contained system that will only cater to the task of running the node software, and any other additional load, like keeping the graphical interface in memory, will not help its performance.
+
You may choose to run a dedicated refurbished laptop on Linux and without a desktop environment, and it would be a wise choice; regarding a Raspberry, while you could install a graphical desktop environment on a Pi 3, it is absolutely not recommended to do so, because it will be a self-contained system that will only cater to the task of running the node software, and any additional load, like keeping the graphical interface in memory, will degrade its performance.
  
 
There is a well known step-by-step guide that will illustrate how to install a full Bitcoin Node on a Raspberry, called the [https://raspibolt.org/ RaspiBolt Guide], plus its amd64/desktop counterpart, directed at laptops/PCs, called [https://minibolt.info MiniBolt]. They both include a section dedicated to installing software for a Lightning Network node, but you will only need to follow the guide for your system up to the configuration of the Bitcoin client.
 
There is a well known step-by-step guide that will illustrate how to install a full Bitcoin Node on a Raspberry, called the [https://raspibolt.org/ RaspiBolt Guide], plus its amd64/desktop counterpart, directed at laptops/PCs, called [https://minibolt.info MiniBolt]. They both include a section dedicated to installing software for a Lightning Network node, but you will only need to follow the guide for your system up to the configuration of the Bitcoin client.
Line 42: Line 42:
 
The initial block download will have your Bitcoin client fetch from the p2p network, and verify one by one, all the blocks since the genesis, which at the time of writing amounts to 570GB of data, so expect from 2 to 10 days of uninterrupted CPU and network activity, depending on the connection (whether clearnet or Tor) and the performance of the hardware (a faster machine will complete the block verification and writing to disk in less time)
 
The initial block download will have your Bitcoin client fetch from the p2p network, and verify one by one, all the blocks since the genesis, which at the time of writing amounts to 570GB of data, so expect from 2 to 10 days of uninterrupted CPU and network activity, depending on the connection (whether clearnet or Tor) and the performance of the hardware (a faster machine will complete the block verification and writing to disk in less time)
  
= Make Bisq connect to your own Bitcoin Node =
+
= Setup the node to accept connections from Bisq =
  
If the Bitcoin node is installed on the same machine as Bisq, the latter will automatically connect to it without the need to edit anything. Considering how Bisq will only run on amd64 architecture, you can achieve this with either your daily driver, or a dedicated laptop through direct or remote access (for example via [[Remote_control_via_web_browser_using_xpra|xpra]]).
+
For the bitcoin connection on Bisq to be effective, you will need to make sure the node's configuration is correct.
 
+
If you installed the client via command line interface following the guides linked above, you will probably have a working config file already, but in case you installed the GUI client, you will have to manually edit the <code>bitcoin.conf</code> file from within the settings, and make sure it contains the following:
For the bitcoin connection on Bisq to be effective though, you will need to edit the bitcoin.conf file.
 
If you installed the client via command line interface following the guides linked above, you will probably have a working config file already, but in case you installed the GUI client, you will have to manually edit the config file from within the settings, and make sure it contains the following:
 
  
 
<code>server=1</code><br>
 
<code>server=1</code><br>
<code>pruned=0</code><br>
+
<code>prune=0</code><br>
 
<code>peerbloomfilters=1</code><br>
 
<code>peerbloomfilters=1</code><br>
  
Line 58: Line 56:
 
* allow Bisq to run SPV queries on the node
 
* allow Bisq to run SPV queries on the node
  
= Connecting to a local Bitcoin node =
+
If the node is running on a separate machine, but on the same local network, it needs to listen for connections from external clients as well, and the easiest way of doing this is to add the following to the config file:
  
If you're running a Bitcoin full node on the same machine as Bisq, Bisq should connect to your node on startup—it will look for Bitcoin Core or <code>bitcoind</code> running on <code>localhost</code> on port 8333.
+
<code>bind=0.0.0.0</code>
  
Just make sure to not be running any other Bitcoin-based altcoin nodes (like LTC) while starting Bisq.
+
No need for the above if the node runs on a different network, and you will connect to it via Tor.
  
= Connecting to another Bitcoin node =
+
After any change to the <code>bitcoin.conf</code> file, the bitcoin client needs to be restarted.
  
By default, Bisq maximizes your privacy by connecting to nodes run by trusted  Bisq contributors.
+
If, on the same remote machine running the node, you installed <code>ufw</code> as the Bolt guides suggest, you have to allow incoming connections on port 8333 (edit the local network base address as needed):
  
If you'd like to connect to another node, you can specify its address in <code>Settings</code> > <code>Network Info</code>. Bisq will validate the address and connect to the specified node the next time it starts.
+
<code>sudo ufw allow from 10.0.0.0/24 to any port 8333 comment 'Bitcoin p2p'</code>
  
Bisq supports connecting to Bitcoin nodes with Tor v3 addresses: this is the easiest path to take, since you only have to fill in your node's onion address in settings.<br>
+
= Setup the connection from Bisq to the node =
If your node is on your local network, connecting directly to it rather than using Tor would reduce latency by a sensible degree. In order to do this:
 
* make sure the node's firewall allows incoming connections on port 8333 from the local network
 
* have Bitcoin daemon listen to <code>0.0.0.0</code> rather than <code>127.0.0.1</code> (add a line that says <code>bind 0.0.0.0</code>)
 
* uncheck "Use Tor for Bitcoin network" under Settings>Network in Bisq application
 
* fill in your node's local network <code>ipaddress:8333</code> in "Use custom bitcoin Core nodes" field
 
  
Explaining in detail each step of the above goes past the scope of this guide, yet you can usually find more information either by searching for specific guides, or asking on discussion boards/groups.
+
The following will change depending on where the node is located respectively to Bisq.
 +
 
 +
== Connecting to a node on the same PC ==
 +
 
 +
If the Bitcoin node is installed on the same machine as Bisq, the latter will automatically connect to it without the need to edit anything. Considering how Bisq will only run on amd64 architecture, you can achieve this with either your daily driver, or a dedicated laptop/desktop through direct or remote access (for example via [[Remote_control_via_web_browser_using_xpra|xpra]]).
 +
 
 +
Make sure no other Bitcoin-based altcoin nodes (like LTC) are running while starting Bisq.
 +
 
 +
== Connecting to a Bitcoin node on the same local network ==
 +
 
 +
After setting the config file to accept connections from external machines, as explained above, you will have to setup Bisq to connect to the remote node. This should be achieved by launching Bisq with the following command-line parameters (as an example, the node on the local network is at 10.0.0.21, edit the command to match your situation):
 +
 
 +
<code>Bisq -btcNodes=10.0.0.21:8333 -useTorForBtc=false</code>
 +
 
 +
Once Bisq has started, you should verify under Settings > Network, that these settings are replicated, in particular you should see that the node's IP:port is filled in the address field, and the "Use Tor for Bitcoin Network" checkbox is disabled.
 +
 
 +
== Connecting to a remote node through the Tor Network ==
 +
 
 +
If you installed the node software on a machine that is geographically separate from your local network, and you followed the Bolt guides, it will be already connecting to the internet through Tor, so you can point Bisq to its onion address.
 +
 
 +
On the node's machine's shell, run
 +
 
 +
<code>bitcoin-cli getnetworkinfo | grep address.*onion</code>
 +
 
 +
to obtain your onion address, copy it to the clipboard and paste it in Bisq under Settings > Network > Use Custom Bitcoin Core nodes
 +
 
 +
Bisq will offer to restart, thus connecting to the custom remote node.
 +
 
 +
= Verify the connection =
 +
 
 +
Once you connect to your own node, Bisq will show <code>Bitcoin network peers: 1</code> in the bottom right corner, and under Settings > Network you will notice the node is the only one listed under "Bitcoin network".
  
 
= Troubleshooting =
 
= Troubleshooting =
 
Most of the issues experienced by users come from trying to associate to a Ronin Dojo node, which often won't let Bisq connect a second time, if at all even the first; we are not aware of any reproducible solution to this, and suggest to use a different node distribution for Bisq.
 
  
 
If you get into a state where Bisq is unable to connect, you can revert to a provided node as follows.   
 
If you get into a state where Bisq is unable to connect, you can revert to a provided node as follows.   
Line 96: Line 117:
 
  <code>C:\Users\your-username-here\AppData\Local\Bisq\Bisq.exe -btcNodes=emzybtc3ewh7zihpkdvuwlgxrhzcxy2p5fvjggp7ngjbxcytxvt4rjid.onion:8333 -useTorForBtc=true </code>
 
  <code>C:\Users\your-username-here\AppData\Local\Bisq\Bisq.exe -btcNodes=emzybtc3ewh7zihpkdvuwlgxrhzcxy2p5fvjggp7ngjbxcytxvt4rjid.onion:8333 -useTorForBtc=true </code>
  
Contributor nodes can be seen [https://github.com/bisq-network/bisq/blob/7c07cdb6ff60ad1186dea33acdfb688668c2aae6/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java#L51-L76 here in the Bisq code].  
+
Contributor nodes can be seen [https://github.com/bisq-network/bisq/blob/7c07cdb6ff60ad1186dea33acdfb688668c2aae6/core/src/main/java/bisq/core/btc/nodes/BtcNodes.java#L51-L76 in the Bisq code].  
  
 
[[Running_from_the_command_line|More info on running from the command line]].
 
[[Running_from_the_command_line|More info on running from the command line]].
  
 
[[Command_line_options|More info on command line options]].
 
[[Command_line_options|More info on command line options]].

Latest revision as of 10:52, 27 November 2023

It is best practice that any Bitcoin user installs his own node, to send and verify his own transactions; moreover, if you use Bisq consistently, you are strongly encouraged to do so, as it will make the bitcoin network connection much more stable, and especially reduce the risk of needing SPV resync on a wallet that contains many transactions. Even when a SPV resync is needed, it will be much painless if done while connected to your own node.

Hardware requirements

The most demanding part of a full Bitcoin node is disk space: 1TB is considered the bare minimum, and a SSD is recommended, as the constant write operations would risk damaging the average mechanical disk. There are pruned nodes that will only keep the very last blocks of the blockchain in order to save on disk space, but as Bisq needs a fully verifying node, we will only be examining this case in the present guide.

The following are viable hardware options to host the node:

  • refurbished laptop with at least 8GB of RAM
    • pros: comes with display, keyboard, and basic storage (existing storage will need to be replaced or expanded), can run multiple services and act as a full fledged home server, has builtin UPS
    • cons: drains more power and is more expensive than a Raspberry Pi 3, takes up more space on your shelf
  • dedicated Raspberry Pi 3
    • pros: very small, low power, completely silent
    • cons: no builtin display, keyboard nor storage, very low performance, needs more initial maintenance
  • your daily driver machine
    • pros: no need to source additional hardware (except the additional storage if it's not enough), will likely not suffer from the limited additional overhead of a Bitcoin node while you use it normally
    • cons: you either have to leave it always running, to keep updated with blocks as soon as they are mined, or will have to wait a variable amount of time for it to catch up to the current block height each time you turn it on, before you can use Bisq

Installing the software

When installing the Bitcoin node software, you will be either working on a graphical user interface, or on a system that only operates via command line (most likely the Raspberry).

Systems with graphical interface

Unless you want to install a leaner daemon setup and follow the command-line steps below, installing directly on a graphical interface is the easier path, as you can download and verify the files as per the instructions on https://bitcoincore.org/en/download/ and then install the software as you normally would on your operating system, making sure you point it to the 1TB drive to save the blockchain.

Systems with command line interface

You may choose to run a dedicated refurbished laptop on Linux and without a desktop environment, and it would be a wise choice; regarding a Raspberry, while you could install a graphical desktop environment on a Pi 3, it is absolutely not recommended to do so, because it will be a self-contained system that will only cater to the task of running the node software, and any additional load, like keeping the graphical interface in memory, will degrade its performance.

There is a well known step-by-step guide that will illustrate how to install a full Bitcoin Node on a Raspberry, called the RaspiBolt Guide, plus its amd64/desktop counterpart, directed at laptops/PCs, called MiniBolt. They both include a section dedicated to installing software for a Lightning Network node, but you will only need to follow the guide for your system up to the configuration of the Bitcoin client.

Caveats

There have been multiple reports about the Ronin node package not allowing Bisq to connect (after the first time), and we know no tested solution for this issue, so it is recommended using the steps above to obtain the Bitcoin node software.

Common steps

No matter the path you chose above, you will have to wait a considerable amount of time after installing the node.

The initial block download will have your Bitcoin client fetch from the p2p network, and verify one by one, all the blocks since the genesis, which at the time of writing amounts to 570GB of data, so expect from 2 to 10 days of uninterrupted CPU and network activity, depending on the connection (whether clearnet or Tor) and the performance of the hardware (a faster machine will complete the block verification and writing to disk in less time)

Setup the node to accept connections from Bisq

For the bitcoin connection on Bisq to be effective, you will need to make sure the node's configuration is correct. If you installed the client via command line interface following the guides linked above, you will probably have a working config file already, but in case you installed the GUI client, you will have to manually edit the bitcoin.conf file from within the settings, and make sure it contains the following:

server=1
prune=0
peerbloomfilters=1

which in turn:

  • enable the block server mode
  • disable the pruning of old blocks
  • allow Bisq to run SPV queries on the node

If the node is running on a separate machine, but on the same local network, it needs to listen for connections from external clients as well, and the easiest way of doing this is to add the following to the config file:

bind=0.0.0.0

No need for the above if the node runs on a different network, and you will connect to it via Tor.

After any change to the bitcoin.conf file, the bitcoin client needs to be restarted.

If, on the same remote machine running the node, you installed ufw as the Bolt guides suggest, you have to allow incoming connections on port 8333 (edit the local network base address as needed):

sudo ufw allow from 10.0.0.0/24 to any port 8333 comment 'Bitcoin p2p'

Setup the connection from Bisq to the node

The following will change depending on where the node is located respectively to Bisq.

Connecting to a node on the same PC

If the Bitcoin node is installed on the same machine as Bisq, the latter will automatically connect to it without the need to edit anything. Considering how Bisq will only run on amd64 architecture, you can achieve this with either your daily driver, or a dedicated laptop/desktop through direct or remote access (for example via xpra).

Make sure no other Bitcoin-based altcoin nodes (like LTC) are running while starting Bisq.

Connecting to a Bitcoin node on the same local network

After setting the config file to accept connections from external machines, as explained above, you will have to setup Bisq to connect to the remote node. This should be achieved by launching Bisq with the following command-line parameters (as an example, the node on the local network is at 10.0.0.21, edit the command to match your situation):

Bisq -btcNodes=10.0.0.21:8333 -useTorForBtc=false

Once Bisq has started, you should verify under Settings > Network, that these settings are replicated, in particular you should see that the node's IP:port is filled in the address field, and the "Use Tor for Bitcoin Network" checkbox is disabled.

Connecting to a remote node through the Tor Network

If you installed the node software on a machine that is geographically separate from your local network, and you followed the Bolt guides, it will be already connecting to the internet through Tor, so you can point Bisq to its onion address.

On the node's machine's shell, run

bitcoin-cli getnetworkinfo | grep address.*onion

to obtain your onion address, copy it to the clipboard and paste it in Bisq under Settings > Network > Use Custom Bitcoin Core nodes

Bisq will offer to restart, thus connecting to the custom remote node.

Verify the connection

Once you connect to your own node, Bisq will show Bitcoin network peers: 1 in the bottom right corner, and under Settings > Network you will notice the node is the only one listed under "Bitcoin network".

Troubleshooting

If you get into a state where Bisq is unable to connect, you can revert to a provided node as follows.

For MacOS:

Bisq -btcNodes=emzybtc3ewh7zihpkdvuwlgxrhzcxy2p5fvjggp7ngjbxcytxvt4rjid.onion:8333 -useTorForBtc=true 

For Linux:

/opt/bisq/bin/Bisq -btcNodes=emzybtc3ewh7zihpkdvuwlgxrhzcxy2p5fvjggp7ngjbxcytxvt4rjid.onion:8333 -useTorForBtc=true 

For Windows:

C:\Users\your-username-here\AppData\Local\Bisq\Bisq.exe -btcNodes=emzybtc3ewh7zihpkdvuwlgxrhzcxy2p5fvjggp7ngjbxcytxvt4rjid.onion:8333 -useTorForBtc=true 

Contributor nodes can be seen in the Bisq code.

More info on running from the command line.

More info on command line options.