Lab 1 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 1   Due: 5:00 pm, Thursday, June 28, 2018

System Setup and Software Installation: 

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:

Bitcoin Core requires a one-time initial download of about 180GB of data plus a further 5-10GB per month to install the full Mainnet Bitcoin blockchain. By default, you will need to store all of that data (if running the mainnet), but if you enable pruning, you can store as little as 6GB total without sacrificing any security. For more information about setting up Bitcoin Core, please read the full node guide.

For our purposes, we will be running on Testnet.  The Bitcoin Wiki contains some information about Testnet, including wallets and faucets (free monopoly money!).

The instructions that follow are for setting up bitcoin core on a Mac computer.  Those running a linux distribution will follow similar instructions.  Those installing on a Windows computer will need to refer to the Windows installation instructions here.  Go to https://bitcoincore.org/en/download/ and download the version 0.16 of the software.  Install it but do not start it.  We cannot give step-by-step installation instructions for multiple environments, so these pages will be helpful if you have questions about installing the software on different hardware and operating system platforms.Note in all cases we will be installing the current version of bitcoin core, which is 0.16.

MAC Instructions:

Create a directory called bitcoin.core (wherever you'd like, off your home directory is fine).  You will need git to proceed further.  If you do not have git installed on your mac, install it from here.  You should also refer to pp. 32ff. of our text Mastering Bitcoin for additional elucidation to the installation process.

cd to your
bitcoin.core directory and issue the following command:

$ git clone https://github.com/bitcoin/bitcoin.git

You will see some output and once it is finished, you will have a new bitcoin subdirectory new created for you.  cd into that new directory:

$ cd bitcoin

Then, run:

$ git tag

You should see a long list of available versions.  You want to set your version to be v0.16.0.  To do this, enter the following command:

$ git checkout v0.16.0

Once done, you should check that your running the correct version:

$ git status
HEAD detached at v0.16.0
nothing to commit, working tree clean

If you see the output above, all is well.  You should read the README.md and
doc/build-osx.md files to acquaint yourself with the general build process.  But make sure you follow the instructions contained in this lab as opposed to the instructions in the .md files.

You will need xcode tools installed as well.  If you already have xcode and tools installed, move ahead to the section on BUILDING.  If not, follow the instructions for installing xcode in the
doc/build-osx.md file, which may including running xcode-select --install.  If you're installing for linux, see the README.md and doc/build-unix.md files instead.

You will also need brew installed so that you can install the dependencies that bitcoin will need:

BUILDING:

Once the prerequisites are installed, begin the build by typing:

$




STEP 2:

Continued intro to docker images and containers with a few examples

For this secoond lab, we are going to run a few more commands which will give you a little more experience in working within Docker.  Make sure you have your runscript working before continuing.

Also, make sure docker is running either on your laptop (Option I from the first lab) or in your VM (Option II from the first lab).  If you are working in a VM, do the following commands inside your Ubuntu VirtualBox VM.

Create a working directory (perhaps something like "~/mpcs51212/lab2" and in that directory type either runscript.linux.sh or runscript.mac.sh.  That will launch a new shell (in your same window), but all  your commands and output will be recorded in a file with an extension of "*.out".  Once you are finished with Step 3 of this lab, simply type "exit" or press "^d" and you will exit the subshell and your activity will be saved.  It will be saved in a file with your login id and a date-time stamp.  The filename will look something like "mark.Tue.Sep.19.17-59-26.CDT.2017.out".  Your userid and time stamp will of course be different.  This is the file you will submit for grading.

Ok, great.  Last week you worked a little with docker images and containers.  But you may be left with a big "so what?".  Well, let's do a little more with a docker container.  Let's hop into it and snoop around a little.  Again, make sure you have your runscript executing so you can save your command output.

In a separate terminal window, open an editor and create and save a file called [yourloginid].Lab2.responses.  When you see the prompt RESPOND #: below in this lab, you will write your answers into this file (Make sure you note the RESPOND prompt (such as "What did that docker run command you just executed above do?" so we will know what you're responding to).  You will submit this response file along with all other supporting documents (ie your script file, etc.).

STEP 3:

Execute the following commands when instructed to do so.

Here's your final task:

Download an apache httpd image, make sure it's running, and make sure you have exposed (linked) port 8080 to your host from your container (you'll likely need to edit httpd.conf), and create a tarball  (docker export) and gzip your tarball and submit it as per the instructions below.  Before submitting it, make sure  you can hit your web server from your host operating system's browser (or curl), as that's how it will be graded.  Finally, talk with your team members about how you might incorporate a web server into your final project solution.

Make sure you SAVE YOUR SCRIPT FILE.

References:

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

Ubuntu package commands

General Docker Tutorial Links

Docker Cheat Sheet

Submitting:
Create a Bitbucket Repository called Lab 2. Upload your Lab 2 script output and any supporting materials to this repo, including your response file. Make sure that the user name "johnhb" has access to this repo.  Please include a README text file that contains any instructions for the TAs to assist with grading, and design notes are often the most useful thing you can provide. We do not usually need any info on how to compile your code unless your code layout is arcane.