install, sync, query bitcoin dummy blockchain (with some extra stuff used in komodo)


#1

bitcoin has all the fundamentals.
1st exercise is install bitcoin, sync blockchain, query blockchain.
Achievements:

  • install from ubuntu package manager
  • start bitcoind
  • locate debug.log to report on status
  • find blockchain height (block number)

Although not necessary (but very handy, and can't emphasize enough) in order to jump right into the guts of komodo by installing it as a notary node. Doing this the learning curve increases rapidly.

Installing dummy bitcoin blockchain to simulate is something like this on ubuntu:

Ubuntu 16.04 used:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate vim software-properties-common curl libcurl4-gnutls-dev cmake clang screen htop

The distribution of ubuntu ships with an older out-dated version of nanomsg so we need a more up-to-date version:
cd ~
git clone https://github.com/nanomsg/nanomsg
cd nanomsg
cmake . -DNN_TESTS=OFF -DNN_ENABLE_DOC=OFF
make -j$(nproc)
sudo make install
sudo ldconfig

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind

cd ~/
cd .bitcoin

echo "rpcpassword=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 17 | head -n 1)" > bitcoin.conf

chmod 600 ~/.bitcoin/bitcoin.conf

bitcoind -regtest -daemon

tail -f ~/.bitcoin/regtest/debug.log
bitcoin-cli -regtest getblockchaininfo
bitcoin-cli -regtest getbalance
bitcoin-cli -regtest generate 99
bitcoin-cli -regtest getbalance
bitcoin-cli -regtest generate 2
bitcoin-cli -regtest getbalance
bitcoin-cli -regtest listunspent
bitcoin-cli -regtest getblockchaininfo
bitcoin-cli -regtest generate 1
bitcoin-cli -regtest getbalance
bitcoin-cli -regtest listunspent
bitcoin-cli -regtest getblockchaininfo

bitcoin-cli -regtest stop

tail -f ~/.bitcoin/regtest/debug.log