Lab 2 Details for MPCS 56600

Each lab will consist of a small problem and details of how to proceed. Each lab is intended to give every student hands-on experience with the core concepts and technologies covered during the course.  A student may concentrate, as a team member, on one technology over another for the final project, but labs are designed to give each and every student exposure to all the technologies that come into play.  You need to submit labs to the TAs for grading--see submission instructions below.  Generally, unless otherwise specified, you will have one week to complete each assigned lab.

See the syllabus for information on grading.  Turning in lab assignments on time is required, without exception, and all late deliveries will be penalized, regardless of cause.  Submit your assignments to the subversion repository according to the directions on the syllabus page.

You may write these solutions in any programming language of your choice.  Our suggestion is now is not the time to learn a new programming language along with the concepts themselves.  So our suggestion is to use whatever programming language you  know best.

Lab 2   Due: 5:00 pm, Monday, April 15, 2019

System Setup and Software Installation (Continued): 

BACKGROUND:

Like all programming problems, learning a new technology is not an exercise in reading but rather an exercise in thinking and typing.  This lab is designed to help you install the bitcoin core software we will be using throughout the course.  You will generally find the References section below helpful in addition to the required and recommended reading. 

This lab has no specific deliverable, and is not graded.

WHAT YOU NEED TO DO:

STEP 1:  Installing the Bitcoin Explorer toolset

For this, you will need to do several things to prepare your machine for building Bitcoin Explorer.  Again, these instructions will be for the Mac.  If you are running Linux, the commands will be very similar, but, depending on your particular flavor (e.g., ubuntu), you will likely need to run some apt gets, but your installation will generally be simpler.  Skip down to "Install Bitcoin Explorer."  Write piazza if you have questions.

On the Mac, the first thing to do is to make sure brew is installed.

Type:

$ brew -v

Hopefully, you will see something like this:

Homebrew 2.0.6
Homebrew/homebrew-core (git revision 4516e; last commit 2019-04-01)

If you don't, you'll need to install brew.  Go here and follow the simple instruction to "Install Homebrew". 

Now, install some brewskies.  Do the following:

brew install automake berkeley-db4 libtool miniupnpc openssl pkg-config protobuf qt libevent python3
brew install boost
brew install jq zmq wget

For the above, although slightly dated, you might find this site somewhat helpful.

Next, you will need to make sure you have installed XCode's common unix utilties. 

To do this, install xcode-select (this site may be helpful) with this command:

xcode-select --install


STEP 1 Linux/Debian/Ubuntu/Xubuntu aptitude equivalent

LINUX ONLY: # basic requirements
LINUX ONLY: sudo apt-get install g++ python3 git
LINUX ONLY: sudo apt-get install git subversion
LINUX ONLY: sudo apt-get install automake libtool pkg-config miniupnpc openssl      
LINUX ONLY: sudo apt-get install libboost-all-dev                                   
LINUX ONLY: sudo apt-get install curl
LINUX ONLY: sudo apt-get install wget
LINUX ONLY: # more specific
LINUX ONLY: sudo apt-get install libevent-dev                                       
LINUX ONLY: sudo apt-get install jq                                                 
LINUX ONLY: sudo apt-get install libzmq3-dev                                      
LINUX ONLY: # heavier and more specific
LINUX ONLY: sudo apt-get install libdb5.3                                          
LINUX ONLY: sudo apt-get install protobuf-compiler                                  
LINUX ONLY: sudo apt-get install qtcreator 
LINUX ONLY: sudo apt-get install libsodium-dev libnorm-dev libpgm-dev
	  


STEP 2 Install Bitcoin Explorer

Download Bitcoin Explorer from the github site here.  Scroll down in the web page until you come to instructions on installing.  Note there are several ways to install, one, building from scratch (instructions are there for Mac, Linux, and Windoze), second, using brew to install (on Mac).  Let's use brew to install Bitcoin Explorer.  (Linux/Windoze users simply follow the instructions on the web page for your OS).  Mac users, execute:

brew install bx

If all goes well, type the following:

bx | head

You should see the following:

Usage: bx COMMAND [--help]

Version: 3.4.0

and a list of the bx commands.  That's all good.


STEP 2 Linux Debian/Ubuntu/Xubuntu/Mint equivalent - compile from source

LINUX ONLY: # create one directory to hold *all* the repos, etc.
LINUX ONLY: $ mkdir libbitcoinstuff
LINUX ONLY: $ cd    libbitcoinstuff
LINUX ONLY:  
LINUX ONLY: # install libbitcoin with one, big .sh install file.
LINUX ONLY: $ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
LINUX ONLY: $ chmod +x install.sh
LINUX ONLY: $ sudo   ./install.sh
LINUX ONLY: $ sudo   ldconfig
LINUX ONLY:  
LINUX ONLY: # now we need a few more libbitcoin items
LINUX ONLY: # - 1 of 4.
LINUX ONLY: $ git clone https://github.com/libbitcoin/libbitcoin-system.git
LINUX ONLY: $ cd libbitcoin-system
LINUX ONLY: $    ./autogen.sh
LINUX ONLY: $    ./configure
LINUX ONLY: $    make
LINUX ONLY: $    sudo make install
LINUX ONLY: $    sudo ldconfig
LINUX ONLY: $    cd ..
LINUX ONLY: # - 2 of 4.
LINUX ONLY: $ git clone https://github.com/libbitcoin/libbitcoin-protocol.git
LINUX ONLY: $ cd libbitcoin-protocol
LINUX ONLY: $    ./autogen.sh
LINUX ONLY: $    ./configure
LINUX ONLY: $    make
LINUX ONLY: $    sudo make install
LINUX ONLY: $    sudo ldconfig
LINUX ONLY: $    cd ..
LINUX ONLY: # - 3 of 4.
LINUX ONLY: $ git clone https://github.com/libbitcoin/libbitcoin-client.git
LINUX ONLY: $ cd libbitcoin-client
LINUX ONLY: $    ./autogen.sh
LINUX ONLY: $    ./configure
LINUX ONLY: $    make
LINUX ONLY: $    sudo make install
LINUX ONLY: $    sudo ldconfig
LINUX ONLY: $    cd ..
LINUX ONLY: # - 4 of 4.
LINUX ONLY: $ git clone https://github.com/libbitcoin/libbitcoin-network.git
LINUX ONLY: $ cd libbitcoin-network
LINUX ONLY: $    ./autogen.sh
LINUX ONLY: $    ./configure
LINUX ONLY: $    make
LINUX ONLY: $    sudo make install
LINUX ONLY: $    sudo ldconfig
LINUX ONLY: $    cd ..
LINUX ONLY:  
LINUX ONLY: # finally, install bx
LINUX ONLY: $ git clone https://github.com/libbitcoin/libbitcoin-explorer.git
LINUX ONLY: $ cd libbitcoin-explorer
LINUX ONLY: $    ./autogen.sh
LINUX ONLY: $    ./configure
LINUX ONLY: $    make
LINUX ONLY: $    sudo make install
LINUX ONLY: $    sudo ldconfig
LINUX ONLY: $    cd ..
	  

References:

You may find the following references helpful (in addition to the links from previous labs):

Installing Bitcoin Core on ubuntu:  https://bitzuma.com/posts/getting-started-with-bitcoin-core-on-ubuntu/, and:  https://linuxhint.com/install-bitcoin-core-ubuntu/
Installing Bitcoin Core on Windoze:  https://www.deepdotweb.com/2017/05/05/tutorial-start-full-bitcoin-node-windows/
Blockchain Information (Bitcoin): https://blockchain.info
Coindesk Blockchain 101: https://www.coindesk.com/information/
Bitcoin Wiki:  https://en.bitcoin.it/wiki/Main_Page
Bitcoin FAQ: https://en.bitcoin.it/wiki/Help:FAQ
Bitcoin Developer’s Reference: https://bitcoin.org/en/developer-reference

Submitting:

Use the folder named "lab2" in your Subversion repository. See the syllabus for more info about submission using Subversion.

Execute the following commands:

ls -laF ~/.bitcoin/* >  ~/lab.2.out.txt
which bx             >> ~/lab.2.out.txt
bx help              >> ~/lab.2.out.txt
# If you are running on Windows:
# - The `which` command is called `where`. 
# - For the `ls` command above, dir /s /b is roughly equivalent. 
# - The tilde (~) will not work, so just supply a full path to that bitcoin directory.

Upload your lab.2.out.txt output to your lab directory.