Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save openoms/23e23a428364e671511d191cc9be0305 to your computer and use it in GitHub Desktop.
Samourai Dojo Copy Node Data
#### Copy over block data to your Dojo ####
## On your machine running Dojo, open 2 terminals, we'll call them [terminal A] & [terminal Doc]
## In [terminal Doc] login to the bitcoind docker container as root
$ sudo docker exec -u root -it bitcoind /bin/bash
## [terminal Doc] Update and install a text editor
$ apt-get update && apt-get install nano
## Stopping bitcoind via 'sudo ./dojo.sh bitcoin-cli stop' shuts the container down, so I found it easiest to
## just add the following to bitcoin.conf and then stop the tor container to cut internet so the bitcoind
## container won't be able to download anything while copying the .bitcoin directory
## [terminal Doc]
$ nano /home/bitcoin/.bitcoin/bitcoin.conf
## Add to bitcoin.conf
onlynet=onion
dnsseed=0
dns=0
ctrl+x --> y --> return
## [terminal A], restart the Dojo so changes to bitcoin.conf take effect
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh stop
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh start
## Pause the TOR container This will stop bitcoind from downloading anything, b/c it won't have internet connection
## [terminal A]
$ sudo docker container pause tor
## Log back into the bitcoind container as root
## [terminal Doc]
$ sudo docker exec -u root -it bitcoind /bin/bash
## Clear out everything but bitcoin.pid and bitcoin.conf from the /.bitcoin folder
## [terminal Doc]
$ mv /home/bitcoin/.bitcoin/bitcoin.conf /home/bitcoin/
$ mv /home/bitcoin/.bitcoin/bitcoind.pid /home/bitcoin/
$ rm -rf /home/bitcoin/.bitcoin/*
## Get the container ID for bitcoind container
$ sudo docker ps | grep bitcoind | cut -d " " -f 1
## from [terminal A], copy the contents of .bitcoin to the bitcoind docker container,
## (where XXXXXXXXXXXX is the full container ID for bitcoind)
$ sudo docker cp /path/to/.bitcoin/ XXXXXXXXXXXX:/home/bitcoin/.bitcoin/
## Go play with yourself for a bit while you wait...
## [terminal Doc] When it's done... remove the bitcoin.conf & bitcoind.pid that you copied over,
## then move the original bitcoin.conf and bitcoind.pid back
$ rm -rf /home/bitcoin/.bitcoin/bitcoin.conf
$ rm -rf /home/bitcoin/.bitcoin/bitcoind.pid
$ mv /home/bitcoin/bitcoin.conf /home/bitcoin/.bitcoin
$ mv /home/bitcoin/bitcoind.pid /home/bitcoin/.bitcoin
## Change ownership of everything to bitcoin:bitcoin
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/blocks/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/blocks/index/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/chainstate/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/indexes/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/indexes/txindex/*
$ chown bitcoin:bitcoin /home/bitcoin/.bitcoin/wallets/*
## [terminal Doc] Reinstall the text editor
$ apt-get update && apt-get install nano
## [terminal Doc] Revert your bitcoin.conf back to allow for clearnet connections
$ nano /home/bitcoin/.bitcoin/bitcoin.conf
## Remove from bitcoin.conf
onlynet=onion
dnsseed=0
dns=0
ctrl+x --> y --> return
## [termainl A] Restart the Dojo
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh stop
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh start
## [terminal A] Check bitcoind progress
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh logs bitcoind
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment