Bitcoin is an innovative and liberating tool. It allows an individual to obtain an independent resource that they can use to easily exchange with other people online, as unlike electronic cash, Bitcoin generates scarcity by limiting the total amount of coins that can circulate in its network.
One way to start using Bitcoin for transactions is to use a full node with a mobile wallet. One of the best tools that you can use is Dojo with Samourai Wallet.
Also read: What Is Bitcoin’s Lightning Network?
How Does Bitcoin Work?
At its core, Bitcoin is a distributed database that keeps track of records in an immutable way. It creates a system that does three things:
- Every new entry in the database depends on the previous one, creating a historical chain of events that links all of the entries to each other.
- Adding a new entry requires you to do a certain amount of work to ensure that anyone who attempts to forge an entry needs to redo that work as well as any work done after it.
- Every full node in the network gets a copy of the database and follows a simple set of rules that, in turn, allows every participant to agree on the correct version of history.
These characteristics of Bitcoin ensure that every new entry in the system is just as secure as the previous one. Its decentralized nature also allows it to run without any central authority.
This makes Bitcoin incredibly useful for individuals who want to transact privately without any third parties.
Also read: How to Earn Cryptocurrency by Browsing the Web
Why Use a Bitcoin Full Node?
A Bitcoin full node is software that allows you to become an independent participant in the Bitcoin network. It provides you with an exact copy of the network’s transaction history and allows you to do a number of things not possible from a normal Bitcoin wallet.
For example, having the entire transaction history allows a full node to verify any incoming transaction by itself. This can be especially helpful for users who accept Bitcoin for their business.
Running a full node also allows you to become an archive for the Bitcoin network. Other users who want to have their own full node can then use yours as a starting point.
Lastly, using a full node also removes the need for external servers whenever you check and broadcast new transactions. This can be useful for users who want to have security and privacy while using Bitcoin.
One of the easiest ways to use a full node is to install Dojo.
What Is Dojo?
Dojo is a powerful software suite that allows you to easily create and deploy a secure Bitcoin node. It also aims to maintain a high degree of security through the use of several privacy-enhancing add-ons as well as Tor.
It’s important to note that the actual installation of Dojo can be both a resource-intensive and time-consuming process, even though the installation steps are easy.
This is mainly because getting the history of Bitcoin transactions requires your computer to verify every entry that it receives. For example, my Core 2 Duo machine from 2011 took five days to fully synchronize with the network.
Further, it is also a good practice to make sure that your computer can store all of the data. For the most part, a 1TB drive should be enough to store the entire history as well as leave space for new ones.
This tutorial focuses on installing Dojo on a Ubuntu 22.04 machine. While most of the commands should work for any Linux distribution, the names of the packages as well as programs may vary.
Also read: What Is Web3 and How Will It Change Your Digital Life
Preparation for Dojo Installation in Ubuntu Linux
To get started, first create a new user account in the system:
sudo useradd -s /bin/bash -d /home/dojo -m -G sudo dojo sudo passwd dojo
This separates any configuration and program that Dojo will run from your user account. A separate account will also reduce the chance for user errors to affect Dojo.
Once done, you can switch to the Dojo user by running: su dojo
, then start installing some distribution-specific dependencies:
sudo apt update sudo apt install gnupg-agent ca-certificates curl software-properties-common unzip tor torbrowser-launcher
Next, include the repository for Docker and Docker Compose.
Download and import the primary signing key for Docker releases:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Add the Docker repository:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt update
Install Docker:
sudo apt install docker-ce docker-ce-cli sudo usermod -aG docker dojo
Finally, install docker-compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
Start downloading Dojo to your machine:
wget https://code.samourai.io/dojo/samourai-dojo/-/archive/master/samourai-dojo-master.zip
Extract all the Dojo files to your machine:
mkdir /home/$USER/dojo unzip /home/$USER/samourai-dojo-master.zip -d /home/$USER/dojo
Configuring Dojo’s Secret Keys
Open the file “docker-bitcoind.conf.tpl” in the dojo folder:
nano /home/$USER/dojo/docker/my-dojo/conf/docker-bitcoind.conf.tpl
The variables that need editing are BITCOIN_RPC_USER=
and BITCOIN_RPC_PASSWORD=
. Dojo uses these to connect to other remote wallets:
BITCOIN_RPC_USER=dojo BITCOIN_RPC_PASSWORD=random_password
Modifying the Dojo Database
The next file that needs to be edited is “docker-mysql.conf.tpl.” It holds all the information that is not directly related to your full node:
nano /home/$USER/dojo/docker/my-dojo/conf/docker-mysql.conf.tpl
Edit three variable in this configuration file: MYSQL_ROOT_PASSWORD=
, MYSQL_USER=
and MYSQL_PASSWORD=
:
MYSQL_ROOT_PASSWORD=your_mysql_root_password MYSQL_USER=dojo MYSQL_PASSWORD=mysql_user_password
Modifying the NodeJS Configuration
The next file to edit is “docker-node.conf.tpl.” It controls the Dojo frontend instance and serves as the glue that combines the full node, MySQL and all the extra features that Dojo uses:
nano /home/$USER/dojo/docker/my-dojo/conf/docker-node.conf.tpl
Inside this file, edit the following variables: NODE_API_KEY=
, NODE_ADMIN_KEY=
and NODE_JWT_SECRET=
.
- NODE_API_KEY serves as the primary secret key for your Dojo’s REST API. This value will allow other services to easily communicate with Dojo when necessary.
- NODE_ADMIN_KEY is the primary password for your Dojo instance. You will type this whenever you want to access your Dojo’s configuration panel.
- NODE_JWT_SECRET serves as the primary salt for your Dojo’s Web Token system and is the value that ensure there is a strong encryption for every Dojo session.
NODE_API_KEY=random_node_api_key NODE_ADMIN_KEY=random_node_admin_key NODE_JWT_SECRET=random_node_jwt_secret
Configuring the Bitcoin Block Explorer
Lastly, you need to edit the “docker-explorer.conf.tpl” file. It controls the internal block explorer for Dojo:
nano /home/$USER/dojo/docker/my-dojo/conf/docker-explorer.conf.tpl
Edit two variables in this configuration file: EXPLORER_INSTALL=
and EXPLORER_KEY=
. The first tells Dojo that you want to install the block explorer, while the second serves as the password for the application.
EXPLORER_INSTALL=on EXPLORER_KEY=random_key
Also read: What Is DeFi And How Does It Work
Installing the Dojo Bitcoin Node in Ubuntu
Next, start the Dojo installation script by running the following command:
/home/$USER/dojo/docker/my-dojo/dojo.sh install
The installation script will download all the necessary tools that it needs to build Dojo’s docker container, then start a compilation process where it will build both the tools and programs that it needs.
The script will start the Dojo executable and immediately synchronize with the Bitcoin network and will indicate this with a difference in layout and color of the terminal. Press Ctrl + C to fork the process to the background.
Checking on Dojo’s Sync Progress
As discussed above, synchronizing with the Bitcoin network can take from a few hours to a few days. It is important to keep track of the node’s progress and look for any potential issues during the sync.
There are two ways to check Dojo’s progress. First, use the “dojo.sh” file to generate a running log of the server. It’s especially useful if you want a quick way to look at the server’s progress. For example, running this command will display all the logs related to the Bitcoin full node:
/home/$USER/dojo/docker/my-dojo/dojo.sh logs bitcoind
It is also possible to check Dojo progress through its dedicated web portal. However, you need to make sure your computer has a copy of the Tor browser to run the following command to print all of the onion addresses that Dojo uses:
/home/$USER/dojo/docker/my-dojo/dojo.sh onion
Next, you need to copy and load the address for the “Dojo API and Maintenance Tool” through the Tor browser to load a small prompt where you can type the admin key that you added earlier.
Dojo will display a brief summary of your node as well as the various states of its services, which is helpful if you want a more comprehensive look at your Dojo instance.
Also read: What You Need to Know About Cryptocurrency Hardware Wallets
Pairing Samourai Wallet With Dojo
Once your Dojo node is properly synchronized with the Bitcoin network, you can pair your mobile wallet to it. By default, the Dojo full node works well with Samourai Wallet for Android.
- Download Samourai wallet from the Play Store.
- Run Samourai Wallet and enable “Connect to your own Dojo server,” then click “Scan QR.”
- On your Dojo’s Maintenance Tool, click the “Pairing” option on the website’s menu on the left to generate a QR code to scan.
- Go back to your Samourai Wallet and scan the QR code in the website.
Congratulations! You have setup your own Bitcoin full node through Dojo.
Frequently Asked Questions
Can I use the same password for the Dojo secret keys?
Yes, but we do not encourage that. The Dojo full node relies on the keys that you provide for some of its sensitive functions. Should an attacker manage to take control of your single key, it is possible for them to snoop and modify your transactions.
Dojo is stuck at 5% while connecting to Tor. Is my Bitcoin node broken?
This is most likely happening because Docker cannot establish a proper external connection. This could happen because your machine has both the apt and snap versions of Docker.
To fix this, remove every instance of Docker and reinstall it with only one version.
I am having a "task: bitcoind blocked for more than 120 seconds" error. What is wrong with my Dojo?
Most likely, your machine is running out of resources during synchronization, so the program trips a “self-hang” state where it waits for sufficient resources. There are instances where this leads to a complete system lock.
It is important to make sure that your computer has the sufficient resources to synchronize and manage a Bitcoin node. Your machine should have at least 1TB of space and 8GB of RAM to comfortably synchronize with the Bitcoin network.
Image credit: Fernando Hernandez via Unsplash
Our latest tutorials delivered straight to your inbox