A satellite connected Samourai Dojo node

in #bitcoin5 years ago

In my previous post (https://steemit.com/bitcoin/@davidcarrington/blockstream-satellite-setup-uk-edition), I described how I set up a receiver for the Blockstream Satellite bitcoin data stream. That's all very nice, but I wanted to actually use it for something useful. I'd been interested in the Samourai Dojo full node for some time, and using their super easy to follow instructions, already set one up on an old desktop PC running Ubuntu that I had lying around. The Dojo setup contains its own bitcoind running in a Docker container, which by defualt will download the entire Bitcoin blockchain over a Tor connection. If you're extra paranoid/security-concious, why not modify the Dojo node to recieve the blockchain over satellite instead! If you're using a reasonably powerful machine with more than 4GB RAM, you can probably run the Dojo and satellite receiver on the same physical box.

Why do this? Well if you've already set up a Bitcoin satellite node and want to run a Dojo (which I highly recommend BTW), doing this will save you the few days or so that you'd spend downloading the blockchain all over again onto your Dojo node, and saving all the disk space that goes with it. You'll also be saving the internet traffic that goes with it.

Fortunately the good people at Samourai have made it easy to change the configuration of Dojo to connect to an external bitcoind node, and for these purposes the fact that our bitcoind is getting its blocks from the satellite is no different as far as Dojo is concerned to any other bitcoind.

I'm assuming at this point that you've already got a Bitcoin Fibre node receiving data successfully from satellite, which is already fully u-to-date on the blockchain, and also the Samourai Dojo source code downloaded on a suitable Linux system. Instructions for installing Dojo can be found here: https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md
You can make these changes either before a fresh Dojo install, or modify an existing one. If modifying an existing Dojo that has a mobile wallet already paired to it, ENSURE YOU HAVE YOUR BACKUP PHRASE AND PASSWORD BEFORE PROCEEDING. If you break the existing Dojo, you'll need these to recover your funds. I've found from experience that the backup file on the wallet is tied to the Dojo that it was paired to, so you can't use this to recover your wallet if that Dojo is dead :-/ Assuming all goes well though, any existing paired wallets will cointinue working as if nothing had changed, they will just be receiving their blockchain info from a differnt source.

First we'll make a few changes to the bitcoind config on our Satellite node. This can be found at /home/<user>/.bitcoin/bitcoin.conf. Open this file in a text editor of your choice, and add the following lines:

rpcpassword=<suitably complex password!>
rpcallowip=0.0.0.0/0
zmqpubrawtx=tcp://<local IP address>:9501
zmqpubhashblock=tcp://<local IP address>:9502

These settings allow Dojo to connect to this bitcoind server using RPC, and subscribe to the raw transaction and block hash messages published over ZMQ.

Now we need to set the corresponding settings for our Dojo node to point it to our Satellite-fed bitcoind server instead of creating its own Docker container. This is quite well described in the Dojo documentation, but I will describe it in full here.

First, if your Dojo is already running, stop it:
from DOJO_DIR/docker/my_dojo
./dojo.sh stop

Edit the config file for the Dojo bitcoind. If you haven't yet installed Dojo, edit the .tpl version of the config, otherwise edit the .conf version:
DOJO_DIR/docker/my_dojo/conf/docker-bitcoind.conf(.tpl)

Change the following settings:

BITCOIND_RPC_USER=<value of "rpcuser" above>
BITCOIND_RPC_PASSWORD=<value of "rpcpassword" above>
BITCOIND_INSTALL=off
BITCOIND_IP=<local IP address of the satellite node>

The port numbers for the ZMQ messages should be already set by default.
Save the file and exit.

If this is a fresh install of Dojo, install it with
DOJO_DIR/docker/my_dojo/dojo.sh install
otherwise restart it with
DOJO_DIR/docker/my_dojo/dojo.sh start

Once installed and started, verify that the local bitcoind container on the Dojo is not running with docker ps. Next, run ./dojo.sh onion to get the onion addresses of the explorer and admin interfaces
Open the explorer page and login, if everything is working properly you should see in the "node status" scetion that the node is synchronised to the blockchain, all without having to download it all over again!

Any Samourai wallet that you have synced to your Dojo will now be using the Satellite bitcoin blockchain, and you will no longer be having to download blocks over the internet.

Remember that you'll have to keep your satellite node up and running connected to the Dojo for any connected wallets to continue working. Should the worst happen and you lose the satellite node for any reason, you can always revert the Dojo config back to its defaults and restart it, in which case you'll have to wait for its local blockchain to sync before it is usable again.

Sort:  

Congratulations @davidcarrington! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You received more than 250 upvotes. Your next target is to reach 500 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 60073.81
ETH 2420.97
USDT 1.00
SBD 2.45