Last active
August 25, 2019 03:31
-
-
Save 05nelsonm/76876de732bc965808c2b363b51db5d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Move your bitcoind data from the Dojo's bitcoind docker container, to outside of the container on your host machine #### | |
## Written for use with Ubuntu Desktop 18.04 LTS & Dojo v1.0.0 ## | |
## Start Dojo | |
$ cd /path/to/docker/my-dojo/ && sudo ./dojo.sh start | |
## Login to the bitcoind docker container as root | |
$ sudo docker exec -u root -it bitcoind /bin/bash | |
## 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 moving the .bitcoin directory | |
## In [terminal Doc] | |
$ nano /home/bitcoin/.bitcoin/bitcoin.conf | |
## Add to bitcoin.conf | |
onlynet=onion | |
dnsseed=0 | |
dns=0 | |
## Save and exit | |
ctrl+x --> y --> return | |
## Make a new directory in the bitcoind container to mount a host directory to | |
$ mkdir /mnt/bitcoin_data | |
## Exit the bitcoind container | |
$ exit | |
## Stop Dojo | |
$ sudo ./dojo.sh stop | |
## Make a new directory in your /path/to/docker/my-dojo/ directory to bind to the bitcoind container | |
## and create a test file to make sure it mounted properly | |
## *** your current working directory should be /path/to/docker/my-dojo/ *** | |
$ mkdir bitcoin_data | |
$ touch bitcoin_data/test | |
## Modify the docker-compose.yaml file to bind mount a host directory to a bitcoind container directory | |
## Under the section for `bitcoind` --> `volumes:` add: | |
- ./bitcoin_data:/mnt/bitcoin_data | |
#### Your bitcoind section should now look something like the following #### | |
bitcoind: | |
image: "samouraiwallet/dojo-bitcoind:1.0.0" | |
container_name: bitcoind | |
build: | |
context: ./bitcoin | |
env_file: | |
- ./.env | |
- ./conf/docker-bitcoind.conf | |
restart: on-failure | |
command: "/wait-for-it.sh tor:9050 --timeout=360 --strict -- /restart.sh" | |
expose: | |
- "28256" | |
- "9501" | |
- "9502" | |
volumes: | |
- ./bitcoin_data:/mnt/bitcoin_data | |
- data-bitcoind:/home/bitcoin/.bitcoin | |
depends_on: | |
- db | |
- tor | |
networks: | |
dojonet: | |
ipv4_address: 172.28.1.5 | |
## Save and exit | |
ctrl+x --> y --> return | |
## Start Dojo | |
$ sudo ./dojo.sh start | |
## Pause the TOR container. This will stop bitcoind from downloading anything b/c it won't have an internet connection | |
$ sudo docker container pause tor | |
## Login to bitcoind container as root | |
$ sudo docker exec -u root -it bitcoind /bin/bash | |
## Ensure that things mounted properly | |
$ cd /mnt/bitcoin_data | |
$ ls -la | |
## You should see the `test` file we created earlier. You can remove it now. | |
$ rm -rf test | |
## Move the .bitcoin directory to your bind mounted directory | |
$ mv /home/bitcoin/.bitcoin/ /mnt/bitcoin_data/ | |
## This takes a bit, and seemed like it locked up my computer but it did not. Be patient. | |
## Took my pc about 15 minutes on an SSD. | |
## Open another terminal [ctrl + alt + t] and make sure the files are there | |
$ cd /home/path/to/docker/my-dojo/ | |
$ du -h bitcoin_data | |
## As of June 2019, my .bitcoin directory was 263G | |
## Exit that new terminal you just opened | |
$ exit | |
## Switching back to your previous terminal and exit the docker container | |
$ exit | |
## Stop Dojo | |
$ sudo ./dojo.sh start | |
## Move files to your host system's home folder | |
$ cd bitcoin_data | |
$ sudo mv .bitcoin ~ | |
## Change ownership of everything to your current user | |
$ sudo chown $USER:$USER ~/.bitcoin/* | |
$ sudo chown $USER:$USER ~/.bitcoin/blocks/* | |
$ sudo chown $USER:$USER ~/.bitcoin/blocks/index/* | |
$ sudo chown $USER:$USER ~/.bitcoin/chainstate/* | |
$ sudo chown $USER:$USER ~/.bitcoin/indexes/* | |
$ sudo chown $USER:$USER ~/.bitcoin/indexes/txindex/* | |
$ sudo chown $USER:$USER ~/.bitcoin/wallets/* | |
##### If there are issues with changing ownership of the txindex/* files (Arguments being too long), try the following: | |
$ sudo find ~/.bitcoin/indexes/txindex/ -type f -exec chown $USER:$USER {} \; | |
## Remove the `.lock` , `.pid` , and `.walletlock` files | |
$ rm -rf ~/.bitcoin/.lock | |
$ rm -rf ~/.bitcoin/bitcoind.pid | |
$ rm -rf ~/wallets/.walletlock | |
## Modify bitcoin.conf (it might need to be modified again if installing the next Dojo release which can be installed ontop | |
## of an already existing bitcoind instance. Follow those directions when doing so for modifying bitcoin.conf as needed). | |
$ nano ~/.bitcoin/bitcoin.conf | |
Begin sample bitcoin.conf file | |
----------------------------------------------------------------------------------------------------------------------------- | |
# Bitcoin Configuration | |
server=1 | |
listen=1 | |
bind=127.0.0.1 | |
# Tor proxy | |
proxy=127.0.0.1:9050 | |
# RPC information | |
rpcport=28256 | |
rpcuser=***your_dojo_rpc_username*** | |
rpcpassword=***your_dojo_rpc_password*** | |
# Store transaction information for fully-spent txns | |
txindex=1 | |
# No wallet | |
disablewallet=1 | |
# ZeroMQ Notification Settings | |
zmqpubrawtx=tcp://127.0.0.1:28333 | |
zmqpubrawblocks=tcp://127.0.0.1:28332 | |
zmqpubhashblock=tcp://127.0.0.1:9502 | |
# Additional Settings | |
rpcthreads=20 | |
----------------------------------------------------------------------------------------------------------------------------- | |
End bitcoin.conf file | |
## Note: if you've previously followed my guide for installing Electrs (Electrum Personal Server), as well as LND with | |
## Dojo v1.0.0, you will **NOT** have to change the configurations for either of those **IF** you use the above .conf file. | |
## If you do need to modify them to work with the standard bitcoindrpc port (default is 8332), those files can be found at: | |
$ nano ~/.lnd/lnd.conf | |
$ sudo nano /usr/share/applications/electrum-personal-server.desktop | |
########## Install Tor ############################################################################################################ | |
## Login to root user | |
$ sudo -s | |
## *** Follow the guide at https://2019.www.torproject.org/docs/debian.html.en *** | |
## Be sure to select the correct distribution of your Linux package | |
## Log out of root user | |
$ exit | |
## Add your user to debian-tor group | |
$ sudo adduser $USER debian-tor | |
## Verify that your username has been added to the debian-tor group (should be the last line of what prints out) | |
$ cat /etc/group | |
## Edit /etc/tor/torrc | |
$ sudo nano /etc/tor/torrc | |
## Add to torrc | |
SocksPort 9050 | |
Log notice stdout | |
ControlPort 9051 | |
CookieAuthentication 1 | |
## Save and exit | |
ctrl+x --> y --> return | |
## Reboot the machine | |
$ sudo shutdown -r now | |
######### Install Bitcoin Core #################################################################################################### | |
## Go to --> https://bitcoincore.org/en/download/ | |
## Follow instructions to verify the download in the section just under the download selection (ABSOLUTELY DO NOT BE LAZY AND SKIP) | |
## Follow instructions to install by going to --> https://bitcoin.org/en/full-node#linux-instructions | |
## Boot it all up and make sure it works! | |
$ bitcoind | |
## Now go get the next release of Dojo! | |
## Done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment