Skip to content

Instantly share code, notes, and snippets.

@pointbiz
pointbiz / bitcoin_full_node.txt
Last active July 18, 2017 10:33
bitcoin full node setup script
#!/bin/bash
#setup script
yum update
yum install nano
homedir=~/
fbtcinfo=btcinfo.sh
echo -e "./bitcoin-cli -datadir=$homedir.bitcoin getinfo
echo -n \"device ip: \"
#get onion address
cat /var/lib/tor/bitcoin-service/hostname > $HOME/onionaddr
onion=$(<$HOME/onionaddr)
echo $onion
[tor]
name=Tor repo
enabled=1
baseurl=https://deb.torproject.org/torproject.org/rpm/el/6/$basearch/
gpgcheck=1
gpgkey=https://deb.torproject.org/torproject.org/rpm/RPM-GPG-KEY-torproject.org.asc
repo_gpgcheck=1
#!/bin/bash
#get current block height from blockchain.infoecho $(date)
wget -4 https://blockchain.info/q/getblockcount &> /dev/null
netblk=$(<getblockcount)
echo "Current Block: $netblk"
#get current block from local bitcoin-cli
./bitcoin-cli getblockcount > locblock
nodeblk=$(<locblock)
echo "Local Block: $nodeblk"
#if bitcoin-cli responds, compare local with network blocks
#!/bin/bash
/root/./bitcoin-cli -datadir=/root/.bitcoin stop
echo Do not shut down the device until notified
x=$(pgrep -f bitcoind)
while [ "$x" != "" ]
do
echo -n "."
sleep 1s
x=$(pgrep -f bitcoind)
done
./bitcoin-cli -datadir=/root/.bitcoin getinfo
echo -n "device ip: "
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
date