Lab 1 Details for MPCS 56605

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: 4:00 pm, Monday, June 26, 2023

SECTION 1: System Setup and Bitcoin 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:  Installing Bitcoin Core

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 using an external USB-based drive.  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:

Go to https://bitcoincore.org/en/download/ and download the version 0.16 of the software for the mac.   Make sure you download the tar.gz file, as in here:

download

Please make sure to download and install the .tar.gz file that corresponds to your chipset. - If you're on Intel, select the .tar.gz for _x86_64 - If your'e on M1 / Apple Silicon, select arm64.  After downloading, you will have a new tar file
.  Untar this file (and you may need to gunzip it as well if it doesn't do that automatically, you can simply do this under the ~/Downloads directory if you wish):

For OS X, the file name is named with apple-darwin:

# for M1 chipsets
tar xvf bitcoin-25.0-arm64-apple-darwin.tar.gz

# for Intel
tar xvf bitcoin-25.0-x86_64-apple-darwin.tar.gz

Next, cd to your /usr/local directory:

$ cd /usr/local

Next, create a Bitcoin directory there (don't change into that directory just yet):

$ sudo mkdir Bitcoin

Then, set your rights on that directory so you don't have to keep running sudo:

$ sudo chmod u+rwX Bitcoin

Next, cd to your new Bitcoin directory:

$ cd Bitcoin/

Now, copy all the files and directories from your download directory into your /usr/local/Bitcoin directory:

$ sudo cp -r ~/Downloads/bitcoin-0.16.0/* .

After copying the contents of the .tar.gz to /usr/local/Bitcoin, add the PATH by adding the following to your ~/.bash_profile:

export PATH="/usr/local/Bitcoin/bin:$PATH"

Or just run: shell echo 'export PATH="/usr/local/Bitcoin/bin:$PATH"' >> ~/.bash_profile

And source it: shell source ~/.bash_profile

Make sure what when you type:

$ which bitcoin-qt

You see:

/usr/local/Bitcoin/bin/bitcoin-qt

Now, run it:

$ bitcoin-qt

When you first execute bitcoin-qt you'll see the error message: "�bitcoin-qt� cannot be opened because the developer cannot be verified."

This just means you need to verify the download. - Show In Finder - Right click: "Open In > Terminal" - You'll see a message: "macOS cannot verify the developer of �bitcoin-qt�. Are you sure you want to open it?" - Click Open

From there you should be able to run bitcoin-qt in your terminal.

You will see a warning dialog saying that it will install under (again this is the Mac) ~/Library/Application Support/Bitcoin, and it will also warn you that you're going to need some 280 GIGABYTES of free space, of which you will perhaps have less than that, possibly much less.  NO WORRIES.  We're not going to actually download the entire Bitcoin Mainnet.  We're just going to let it think it's doing that...let it get itself started.

Once you click on Continue, you'll see that it starts "Syncing Headers" in the lower left status bar.  The picture below shows headers at 81.4% complete.  Let it get to 100%. 

pic1

Once you've got all the headers, it will begin to actually download the bitcoin blockchain.  Again, don't panic if you only have 20 gig free.  We're not going to let it get close to that. 

You'll see that it starts downloading blocks in the blockchain, and that will look like this:

pic2

In this image, you can see that it's begun "Synchronizing with network..." (see status bar lower left).  This is a GOOD SIGN.  You're downloading the Bitcoin blockchain.  But to you really want to spend "3 weeks" downloading the whole enchilada?  This screen shows there's over half a million blocks still to download.  Once you see that the blocks are successfully downloading, you can click on File/Close to exit out of bitcoin-qt.  This will be that last time we run this in our labs. 

WHERE ARE WE?  We have successfully installed the bitcoin core software, and we have initialized our environment and software.  Now, let's look in that Bitcoin directory:

$ ls -1 ~/Library/Application\ Support/Bitcoin

Note the escaping of the space before the word Support.  You should see (something like) the following files and directories:

banlist.dat
blocks
chainstate
debug.log
fee_estimates.dat
mempool.dat
peers.dat
wallets

Notice there's a directory there called "wallets".  Congratulations!  You've got a wallet to play around with.

NOW, we need to set up a config file for mainnet.  Download this file (bitcoin.MAINNET.conf) into your ~/Library/Application\ Support/Bitcoin directory.  Make sure it's there.  Now, edit the file and modify the following two lines:

rpcuser=markrpc

to a username you like, like "paulrpc" or "billybob".

Next, create a hard-to-guess password that you've never used before and replace the following rpcpassword text from "CHANGE_THIS_TO_SOMETHING" to a password of your choice:

rpcpassword=CHANGE_THIS_TO_SOMETHING

 
You can use a password manager to generate a good one or you can just type random letters and numbers there.  This is used only on your machine and you don't have to remember it.  So just make it look somewhat random, like (don't use this but...):
 

rpcpassword=sdjfa3u98hfleiurhf88

I literally just typed a bunch of "random" letters and numbers.

Once updated, save the file and exit.


NOW, we need to change over from Mainnet to Testnet, so we can play around with Monopoly Bitcoins and not real ones!  Download this file
(bitcoin.conf) into your ~/Library/Application\ Support/Bitcoin directory.  Make sure it's there.  Now, edit the file and modify the following two lines:

rpcuser=markrpc

to a username you like, like "paulrpc" or "billybob".

Next, create a hard-to-guess password that you've never used before and replace the following rpcpassword text from "CHANGE_THIS_TO_SOMETHING" to a password of your choice:

rpcpassword=CHANGE_THIS_TO_SOMETHING

 
You can use a password manager to generate a good one or you can just type random letters and numbers there.  This is used only on your machine and you don't have to remember it.  So just make it look somewhat random, like (don't use this but...):
 

rpcpassword=sdjfa3u98hfleiurhf88

I literally just typed a bunch of "random" letters and numbers.  Note it can simply be the same password you typed into your mainnet conf file above.

Once updated, save the file and exit.

Now, you're going to manually kick off bitcoind (previously bitcoin-qt did it for you).  To do this, in your terminal, type:

$ bitcoind -testnet --printtoconsole

You'll see a TON of output, starting with something like this (I've elided some of the text):

2018-06-10 17:22:20 Bitcoin Core version v0.16.0 (release build)
2018-06-10 17:22:20 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-06-10 17:22:20 Assuming ancestors of block 0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0 have valid signatures.
2018-06-10 17:22:20 Setting nMinimumChainWork=000000000000000000000000000000000000000000f91c579d57cad4bc5278cc
2018-06-10 17:22:20 Using the 'sse4' SHA256 implementation
2018-06-10 17:22:20 Using RdRand as an additional entropy source
2018-06-10 17:22:20 Default data directory /Users/mark/Library/Application Support/Bitcoin
2018-06-10 17:22:20 Using data directory /Users/mark/Library/Application Support/Bitcoin
2018-06-10 17:22:20 Using config file /Users/mark/Library/Application Support/Bitcoin/bitcoin.conf
2018-06-10 17:22:20 Using at most 125 automatic connections (2560 file descriptors available)
2018-06-10 17:22:20 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-06-10 17:22:20 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-06-10 17:22:20 Using 4 threads for script verification
2018-06-10 17:22:20 scheduler thread start
2018-06-10 17:22:20 Using wallet directory /Users/mark/Library/Application Support/Bitcoin/wallets
2018-06-10 17:22:20 init message: Verifying wallet(s)...
2018-06-10 17:22:20 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2018-06-10 17:22:20 Using wallet wallet.dat
2018-06-10 17:22:20 CDBEnv::Open: LogDir=/Users/mark/Library/Application Support/Bitcoin/wallets/database ErrorFile=/Users/mark/Library/Application Support/Bitcoin/wallets/db.log
2018-06-10 17:22:20 Cache configuration:
2018-06-10 17:22:20 * Using 2.0MiB for block index database
2018-06-10 17:22:20 * Using 8.0MiB for chain state database
2018-06-10 17:22:20 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-06-10 17:22:20 init message: Loading block index...
2018-06-10 17:22:20 Opening LevelDB in /Users/mark/Library/Application Support/Bitcoin/blocks/index
2018-06-10 17:22:21 Opened LevelDB successfully
2018-06-10 17:22:21 Using obfuscation key for /Users/mark/Library/Application Support/Bitcoin/blocks/index: 0000000000000000
2018-06-10 17:22:21 LoadBlockIndexDB: last block file = 0
2018-06-10 17:22:21 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
2018-06-10 17:22:21 Checking all blk files are present...
2018-06-10 17:22:21 LoadBlockIndexDB: transaction index disabled
2018-06-10 17:22:21 Initializing databases...
2018-06-10 17:22:21 Pre-allocating up to position 0x1000000 in blk00000.dat
2018-06-10 17:22:21 Opening LevelDB in /Users/mark/Library/Application Support/Bitcoin/chainstate
2018-06-10 17:22:21 Opened LevelDB successfully
2018-06-10 17:22:21 Wrote new obfuscate key for /Users/mark/Library/Application Support/Bitcoin/chainstate: 5b53589e86e2cec3
2018-06-10 17:22:21 Using obfuscation key for /Users/mark/Library/Application Support/Bitcoin/chainstate: 5b53589e86e2cec3
2018-06-10 17:22:21 init message: Rewinding blocks...
2018-06-10 17:22:21  block index             470ms
2018-06-10 17:22:21 init message: Loading wallet...
2018-06-10 17:22:21 nFileVersion = 160000
2018-06-10 17:22:21 Keys: 0 plaintext, 0 encrypted, 0 w/ metadata, 0 total
2018-06-10 17:22:21 Performing wallet upgrade to 60000
2018-06-10 17:22:22 keypool added 2000 keys (1000 internal), size=2000 (1000 internal)
2018-06-10 17:22:22  wallet                 1445ms
2018-06-10 17:22:22 setKeyPool.size() = 2000
2018-06-10 17:22:22 mapWallet.size() = 0
2018-06-10 17:22:22 mapAddressBook.size() = 0
2018-06-10 17:22:22 UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03 18:15:05' progress=0.000000 cache=0.0MiB(0txo)
2018-06-10 17:22:22 Failed to open mempool file from disk. Continuing anyway.
2018-06-10 17:22:22 mapBlockIndex.size() = 1
2018-06-10 17:22:22 nBestHeight = 0
2018-06-10 17:22:22 torcontrol thread start
2018-06-10 17:22:22 AddLocal([2601:248:200:4516:815:bf31:6b66:e526]:8333,1)
2018-06-10 17:22:22 Discover: IPv6 en0: 2601:248:200:4516:815:bf31:6b66:e526
2018-06-10 17:22:22 AddLocal([2601:248:200:4516:7d26:76b:d7a3:d013]:8333,1)
2018-06-10 17:22:22 Discover: IPv6 en0: 2601:248:200:4516:7d26:76b:d7a3:d013
2018-06-10 17:22:22 AddLocal([2601:248:200:4516::931c]:8333,1)
2018-06-10 17:22:22 Discover: IPv6 en0: 2601:248:200:4516::931c
2018-06-10 17:22:22 Bound to [::]:8333
2018-06-10 17:22:22 Bound to 0.0.0.0:8333
2018-06-10 17:22:22 init message: Loading P2P addresses...
2018-06-10 17:22:22 ERROR: DeserializeFileDB: Failed to open file /Users/mark/Library/Application Support/Bitcoin/peers.dat
2018-06-10 17:22:22 Invalid or missing peers.dat; recreating
2018-06-10 17:22:22 init message: Loading banlist...
2018-06-10 17:22:22 ERROR: DeserializeFileDB: Failed to open file /Users/mark/Library/Application Support/Bitcoin/banlist.dat
2018-06-10 17:22:22 Invalid or missing banlist.dat; recreating
2018-06-10 17:22:22 init message: Starting network threads...
2018-06-10 17:22:22 net thread start
2018-06-10 17:22:22 dnsseed thread start
2018-06-10 17:22:22 addcon thread start
2018-06-10 17:22:22 init message: Done loading
2018-06-10 17:22:22 opencon thread start
2018-06-10 17:22:22 msghand thread start
2018-06-10 17:22:22 Loading addresses from DNS seeds (could take a while)
2018-06-10 17:22:22 GUI: Platform customization: "macosx"
2018-06-10 17:22:23 GUI: PaymentServer::LoadRootCAs: Loaded  169  root certificates
2018-06-10 17:22:24 New outbound peer connected: version: 70015, blocks=526877, peer=0
2018-06-10 17:22:24 220 addresses found from DNS seeds
2018-06-10 17:22:24 dnsseed thread exit
2018-06-10 17:22:25 New outbound peer connected: version: 70015, blocks=526877, peer=1
2018-06-10 17:22:26 New outbound peer connected: version: 70015, blocks=526877, peer=2
2018-06-10 17:22:27 New outbound peer connected: version: 70015, blocks=526877, peer=3
2018-06-10 17:22:27 New outbound peer connected: version: 70015, blocks=526877, peer=4
2018-06-10 17:22:35 New outbound peer connected: version: 70015, blocks=526877, peer=5
2018-06-10 17:22:39 New outbound peer connected: version: 70015, blocks=526877, peer=6
2018-06-10 17:22:57 New outbound peer connected: version: 70015, blocks=526877, peer=7

And then, it may just hang there for a while...no worries, it's just bootstrapping and setting up peer nodes to talk to, and download the TESTNET blockchain from.  Be patient.  This could take from 1 to 10 minutes, depending on bandwidth, etc.  Eventually, you should see the following output:

2018-06-10 17:23:36 Pre-allocating up to position 0x100000 in rev00000.dat
2018-06-10 17:23:36 UpdateTip: new best=00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 height=1 version=0x00000001 log2_work=33.000022 tx=2 date='2009-01-09 02:54:25' progress=0.000000 cache=0.0MiB(1txo)
2018-06-10 17:23:36 UpdateTip: new best=000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd height=2 version=0x00000001 log2_work=33.584985 tx=3 date='2009-01-09 02:55:44' progress=0.000000 cache=0.0MiB(2txo)
2018-06-10 17:23:36 UpdateTip: new best=0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449 height=3 version=0x00000001 log2_work=34.000022 tx=4 date='2009-01-09 03:02:53' progress=0.000000 cache=0.0MiB(3txo)
2018-06-10 17:23:36 UpdateTip: new best=000000004ebadb55ee9096c9a2f8880e09da59c0d68b1c228da88e48844a1485 height=4 version=0x00000001 log2_work=34.32195 tx=5 date='2009-01-09 03:16:28' progress=0.000000 cache=0.0MiB(4txo)
2018-06-10 17:23:36 UpdateTip: new best=000000009b7262315dbf071787ad3656097b892abffd1f95a1a022f896f533fc height=5 version=0x00000001 log2_work=34.584985 tx=6 date='2009-01-09 03:23:48' progress=0.000000 cache=0.0MiB(5txo)
2018-06-10 17:23:36 UpdateTip: new best=000000003031a0e73735690c5a1ff2a4be82553b2a12b776fbd3a215dc8f778d height=6 version=0x00000001 log2_work=34.807377 tx=7 date='2009-01-09 03:29:49' progress=0.000000 cache=0.0MiB(6txo)
2018-06-10 17:23:36 UpdateTip: new best=0000000071966c2b1d065fd446b1e485b2c9d9594acd2007ccbd5441cfc89444 height=7 version=0x00000001 log2_work=35.000022 tx=8 date='2009-01-09 03:39:29' progress=0.000000 cache=0.0MiB(7txo)
2018-06-10 17:23:36 UpdateTip: new best=00000000408c48f847aa786c2268fc3e6ec2af68e8468a34a28c61b7f1de0dc6 height=8 version=0x00000001 log2_work=35.169947 tx=9 date='2009-01-09 03:45:43' progress=0.000000 cache=0.0MiB(8txo)
2018-06-10 17:23:36 UpdateTip: new best=000000008d9dc510f23c2657fc4f67bea30078cc05a90eb89e84cc475c080805 height=9 version=0x00000001 log2_work=35.32195 tx=10 date='2009-01-09 03:54:39' progress=0.000000 cache=0.0MiB(9txo)
2018-06-10 17:23:36 UpdateTip: new best=000000002c05cc2e78923c34df87fd108b22221ac6076c18f3ade378a4d915e9 height=10 version=0x00000001 log2_work=35.459454 tx=11 date='2009-01-09 04:05:52' progress=0.000000 cache=0.0MiB(10txo)
. . .

This is great news.  You've started with block height 1 from January 9, 2009, downloaded that block, then downloaded the next block at height 2, then the block at height 3, and on and on and on.  Feel free to let this run for a while.  When you get bored, simply press "Ctrl-C" in your terminal window and bitcoind will shut down gracefully like a boss.

Whenever you subsequently run bitcoind -testnet --printtoconsole, you'll see the following output at startup of bitcoind:

2018-06-10 18:44:41 Bitcoin Core version v0.16.0 (release build)
2018-06-10 18:44:41 InitParameterInteraction: parameter interaction: -blocksonly=1 -> setting -whitelistrelay=0
2018-06-10 18:44:41 Assuming ancestors of block 0000000002e9e7b00e1f6dc5123a04aad68dd0f0968d8c7aa45f6640795c37b1 have valid signatures.
2018-06-10 18:44:41 Setting nMinimumChainWork=00000000000000000000000000000000000000000000002830dab7f76dbb7d63
2018-06-10 18:44:41 WalletParameterInteraction: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0
2018-06-10 18:44:41 Using the 'sse4' SHA256 implementation
2018-06-10 18:44:41 Using RdRand as an additional entropy source
2018-06-10 18:44:41 Default data directory /Users/mark/Library/Application Support/Bitcoin
2018-06-10 18:44:41 Using data directory /Users/mark/Library/Application Support/Bitcoin/testnet3
2018-06-10 18:44:41 Using config file /Users/mark/Library/Application Support/Bitcoin/bitcoin.conf
2018-06-10 18:44:41 Using at most 16 automatic connections (256 file descriptors available)
2018-06-10 18:44:41 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-06-10 18:44:41 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-06-10 18:44:41 Using 0 threads for script verification
2018-06-10 18:44:41 scheduler thread start
2018-06-10 18:44:41 Binding RPC on address 0.0.0.0 port 18332 failed.
2018-06-10 18:44:41 HTTP: creating work queue of depth 16
2018-06-10 18:44:41 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2018-06-10 18:44:41 HTTP: starting 4 worker threads
2018-06-10 18:44:41 Using wallet directory /Users/mark/Library/Application Support/Bitcoin/testnet3/wallets
2018-06-10 18:44:41 init message: Verifying wallet(s)...
2018-06-10 18:44:41 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2018-06-10 18:44:41 Using wallet wallet.dat
2018-06-10 18:44:41 CDBEnv::Open: LogDir=/Users/mark/Library/Application Support/Bitcoin/testnet3/wallets/database ErrorFile=/Users/mark/Library/Application Support/Bitcoin/testnet3/wallets/db.log

I've highlighted above the things you'll want to make sure you see as you run TESTNET in bold above.  Mainly, you want to make sure that bitcoind is operating out of testnet3.  See bold entries above...Don't worry about the RPC binding error.

Now, we're going to create a few aliases to help us along.  Linux people you can do the same.  Windows users, you'll either have to write some proshell scripts or run cygwin or just  type out the contents of the aliases manually (with Windows slashes replaced, etc.).

First, let's establish a symbolic link to our Mac Library bitcoin subdirectory:

ln -s /Users/[YOURID]/Library/Application\ Support/Bitcoin/ .bitcoin

This will make things a little easier in getting to our Bitcoin directory, how instead of typing, with the escaping:

cd
/Users/mark/Library/Application\ Support/Bitcoin/

we can simply type (don't forget the '.', it's a hidden directory):

cd ~/.bitcoin

and we're there.  This will make things a little bit more "linuxy".  (Linux people note you may already have this as your bitcoin directory).

Now, we want to append some aliases and exports to your .bashrc startup file.  Download this file and place it in your home directory.

NOTE:  For the following, DO NOT merely o
pen  your .bashrc or .bash_profile file, whichever  you're actively using, and paste the contents of bashrc.addendum.sh in your file.  This will not work.

Execute (assuming your startup file is .bashrc):

cd
cat bashrc.addendum.sh >> .bashrc

This will add several commands that will hopefully make your life a little easier running bitcoin core and especially bitcoin-cli.  The lines added are:

export BLOCKCHAIN='testnet'
alias btcdir="cd ~/.bitcoin/" #linux default bitcoind path
alias bitc='/usr/local/Bitcoin/bin/bitcoin-cli -${BLOCKCHAIN} '
alias bitd='/usr/local/Bitcoin/bin/bitcoind -${BLOCKCHAIN} -printtoconsole '
alias bitd-MAINNET='/usr/local/Bitcoin/bin/bitcoind -mainnet -conf=~/.bitcoin/bitcoin.MAINNET.conf -printtoconsole '
alias bitc-MAINNET='/usr/local/Bitcoin/bin/bitcoin-cli -mainnet -conf=~/.bitcoin/bitcoin.MAINNET.conf '
alias btcinfo='bitcoin-cli -${BLOCKCHAIN} getwalletinfo | egrep "\"balance\""; bitcoin-cli -${BLOCKCHAIN} getnetworkinfo | egrep "\"version\"|connections"; bitcoin-cli -${BLOCKCHAIN} getmininginfo | egrep "\"blocks\"|errors"'
alias btcblock="echo \`bitcoin-cli -testnet getblockcount 2>&1\`/\`wget -O - http://blockexplorer.com/testnet/q/getblockcount 2> /dev/null | cut -d : -f2 | rev | cut -c 2- | rev\`"

The above aliases make life a little easier and allow us to hop back and forth between mainnet, testnet, and regtest (later), by simply changing the BLOCKCHAIN variable in a terminal to one of the following:

BLOCKCHAIN='mainnet'  (for the main bitcoin blockchain...WARNING
...WARNING...WARNING)
BLOCKCHAIN='testnet' (our default)
BLOCKCHAIN='regtest' (for regtest)

Save your .bashrc file (or .bash_profile) and launch a new terminal.

Now, launch your bitcoind server again, but this time, use your alias:

$ bitd

You should see your same old output again as it syncs up with peers, and begins to further download the blocks on TESTNET.  Keep it running. 
At some point you will have downloaded all the blocks on TESTNET.

You need to let bitcoind run for long enough to synchronize headers; this can take awhile depending on your internet connection.

After starting bitcoind make sure to let it run long enough so that the Pre-synchronizing blockheaders step is complete - this will take several minutes depending on your internet connection. There is a progress percentage indication on this line.

Eventually you'll start seeing messages that look like this: New outbound peer connected: version: 70015, blocks=2436469, peer=8 (block-relay-only)

After the pre-synchorization step runs it will then begin synchronizing headers. You'll see messages that look like this: Synchronizing blockheaders, height: 374041 (~46.74%)

Continue letting the bitcoind run.

You can close it when you start seeing messages that look like this: UpdateTip: new best=000000000e95bc359b6ba3628cfeb6c208e9a4f8e3ef10916a33ec2a669612d4 height=13994 version=0x00000001 log2_work=47.907898 tx=24868 date='2012-05-28T05:12:07Z' progress=0.000378 cache=2.6MiB(14713txo)

Important: Gracefully shutdown bitcoind (Ctrl-C will do fine) so it can cleanup resources; do not force-exit the terminal (or you may have problems on the next invocation and will need to start over).

Congrats.  You're up and running.



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: 4.0.0

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


SECTION 2: System Setup and Bitcoin Software Installation (Continued): 

WHAT YOU NEED TO DO:

STEP 1Installing 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 a post to our Ed site 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 4.x.x

Homebrew/homebrew-core (git revision 05550; last commit 2023-02-xx)

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:
Packages to install with brew are below, however please review this list before proceeding. You may be familiar with many of them and do not need to change or upgrade your setup.

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

brew install jq
brew install zmq
brew install 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 utilities.

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

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


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 equivalent - compile from source

# install libbitcoin with one, big .sh install file.
$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
$ chmod +x install.sh
$ sudo   ./install.sh

# ... then, install bx
$ git clone https://github.com/libbitcoin/libbitcoin-explorer.git
$ cd libbitcoin-explorer
$    ./autogen.sh
$    ./configure
$    make
$    sudo make install
	  

SECTION 3: System Setup and Ethereum Software Installation (Continued): 

WHAT YOU NEED TO DO:

We are now going to install most of the software that will be required to run Ethereum and develop smart contracts on it.  We will be guiding you through installation of tools on a mac running MacOS.  For other operating systems (your mileage will vary), obtain the commensurate software and you're mostly on your own with your choices.

First, let's install node, truffle, and ganache:

We need to make sure you have brew installed, because we will be leveraging several brew installations.  Install brew (if you don't already have brew installed) by issuing this command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once installed, update your PATH variable to include the brew command path, for example:

/opt/homebrew/bin/brew

Then restart your terminal(s) to include the newly-updated PATH.

To make sure brew is available and runable:

$ brew list

(this should show a listing of any brew installations.  As long as you see no errors you're all good.)

NODE:

Now, let's install node version 16 (again, if you don't already have it installed):

$ brew install node@16

You should see a lot of downloading and fetching notifications, pouring a bunch of dependencies, just give it a moment to complete.  You may see some moderate severity vulnerabilities and instructions on running npm audit.  Ignore all this.

After installing node, once again update your PATH to include the new location of node (e.g., /opt/homebrew/opt/node@16/bin).  Again, restart your terminal(s) to include the newly-updated PATH.  At this point, you should be able to verify the node version:

$ node --version
v16.20.0 [or something like this]

TRUFFLE [our build and testing environment]:

Now, let's use node to install truffle:

$ npm install -g truffle

This will install truffle tools under /usr/local/bin/truffle (etc.).  You should be able to verify your truffle version:

$ npm --version
8.19.4
[or something like this]

You can also type:

$ which truffle

and see where your truffle was installed:

$ which truffle
/usr/local/bin/truffle
[or something like this]

GANACHE [our Ethereum playground]:

Now, let's install ganache:

Go to https://trufflesuite.com/ganache/ and under the DOWNLOAD (MACOS) button, click on "Need another OS download?".  You will be taken to a github site.  YOu want to scroll down until you see "v2.7.1 Bug-Banishing Baked Goods" and scroll down further and choose the file "Ganache-2.7.1-mac.dmg".  Wait for that file to download, and then navigate to your download folder and launch the dmg file.


Now, simply drag and drop Ganache.app onto the Applications folder.

Now, let's start ganache.  Launch ganache and if you get a warning that Ganache.app is an app downloaded from the internet, just choose to Open it anyway.  If you see a Support Ganache screen, you can choose whether to enable analytics or not (I don't), and then click on Continue.  At this point, you will see the initial Ganache workspace screen.  You won't have any existing workspaces, so you can simply click on "QUICKSTART ETHEREUM". 

After a little churning, you will see the main Ganache Ethereum Blockchain screen come up with a bunch of account addresses and balances on it:

Don't worry if not much of this makes any sense.  It will all make very good sense over the next several weeks as we talk about HD wallets and mnemonics (tres cool).  Speaking of which, your account addresses, mnemonics, etc., will all be different.  But the structure of the ganache screen will be the same, including the current block (0), Gas Price and Limit, Merge hard fork, network id (5777) and RPC Server (HTTP://127.0.0.1:7545), automining on, etc.  And, by the way, you're Rich!  You've got 10 accounts each with 100.00 ETH in them!  That's 1,000 ETH.  The good news is that ETH is currently trading around $1,800 per coin.  That's just shy of $2MM clams.  The bad news, of course, is that you're rich in only monopoly money, so you're just as poor as when you started this lab.  C'est la vie.  We will be using Ganache as our own little private ethereum blockchain playground, where we can write smart contracts using truffle and solidity, and deploy them onto our ganache playground.  And although you're not rich, at least it won't cost you a penny (or Gwei) to deploy and run your Dapps.

VISUAL STUDIO CODE:

Finally, we will benefit from an integrated development environment so our solidity coding will be a little easier  (at least compared to vi).  For this, we're turning to the Dark Side.  Visit https://code.visualstudio.com/ and you'll see something like this:

Click on "Download Mac Universal Stable Build" and install VS Code.  After the download is complete, go to your Downloads folder and double click on the zip file (e.g., VSCode-darwin-universal.zip).  Once the zip file has expanded, move the executable "Visual Studio Code.app" into your /Applications directory.  Go ahead and launch it from your Applications directory.  Note if you get a warning that the app is an app downloaded from the internet, just choose to Open it anyway.  Once it opens, you should see the default VS Code screen that looks like this:

At this point, you can close the app as we're done with it for now.  We'll be coding inside it soon enough.

Now, let's install geth, clef, and prysm:

In order to actually run a "real" ethereum blockchain (as one peer node among many), we need some serious tools to do so.  We will need to run an execution node (which manages the "pre-merge" proof-of-stake blocks), a beacon node (which manages the "post-merge" proof-of-stake blocks), and an account manager (clef).  Although we will not be running the actual Ethereum mainnet blockchain, we will be utilizing the current proof-of-stake testnet, known as Sepolia.

First, go to https://geth.ethereum.org/downloads and scroll down until you see Stable Releases.  Choose the release for "Geth & Tools 1.11.5" and click it to download.  Once downloaded, unzip the file and then cd into your downloaded directory (e.g., cd geth-alltools-darwin-amd64-1.11.5-a38f4108) and then issue the following commands at the terminal prompt:

$ sudo mkdir -p /usr/local/ethereum/bin

$ sudo cp * /usr/local/ethereum/bin/

Then, update your PATH variable in your configuration file (e.g., .bashrc) to include the new directory "/usr/local/ethereum/bin" and restart your terminal(s) to include the newly-updated PATH.

Plug in your external drive (you can use the same external drive you may have used for bitcoin above).  My external drive's name is set to "Ethereum" for the instructions below (if you wish to name your drive something else that's fine but you will have to make adjustments to the directory instructions below, which is fine if that's what you wish or need).  NOTE:  If your external drive is ExFAT, you will want to repartition/format it to Mac OS Extended (Case Sensitive, Journaled).  Otherwise, your mileage may vary.  If you need to reformat your external drive, run Disk Utility from the /Applications/Utilities folder and choose to Erase your external drive.  MAKE SURE you've selected your external drive and not your default hard drive!  Make sure you reformat your drive (by "erasing" it) to use Mac OS Extended (Case-sensitive, Journaled):

Once erased (and reformatted), it will look like this:

MKDIR:

Plug in your external drive if it's not already plugged in and change to your new /Volumes/Ethereum directory (we are assuming your laptop computer doesn't have a few Terabytes free of course...), and enter the following commands:

$ mkdir -p /Volumes/Ethereum/myEthereum

$ mkdir -p /Volumes/Ethereum/Ethereum

$ mkdir -p /Volumes/Ethereum/Eth2


Now, cd to your /Volumes/Ethereum/myEthereum subdirectory:

$ cd /Volumes/Ethereum/myEthereum

Now, cd to your /Volumes/Ethereum/myEthereum subdirectory and create a few new subdirectories:

$ mkdir clef execution consensus

$ mkdir consensus/prysm

Now, cd to your Library directory under your home directory:

$ cd ~/Library

Now, we're going to create two symbolic links out to your external drive (again, assuming your external drive is mounted under /Volumes/Ethereum):

$ ln -s /Volumes/Ethereum/Ethereum ./Ethereum

$ ln -s /Volumes/Ethereum/Eth2 ./Eth2

When you are all done, you should have a directory structure that looks like this:

Under /Volumes/Ethereum, you should have these subdirectories (you can confirm by issuing the command "find /Volumes/Ethereum"):

/Volumes/Ethereum/myEthereum

/Volumes/Ethereum/myEthereum/clef

/Volumes/Ethereum/myEthereum/consensus

/Volumes/Ethereum/myEthereum/consensus/prysm

/Volumes/Ethereum/myEthereum/execution

/Volumes/Ethereum/Ethereum

/Volumes/Ethereum/Eth2

Under your Library subdirectory under your home directory, you should have these subdirectories (you can confirm by issuing the command "find /Volumes/Ethereum"):

~/Library/Ethereum (symlink to /Volumes/Ethereum/Ethereum)

~/Library/Eth2 (symlink to /Volumes/Ethereum/Eth2)

Please confirm that your directory structure matches the above.

Now, when we launch geth (a few steps below), it will write the blockchain out to our externally mounted volume (and not to our local laptop or desktop drive).

CLEF:

Let's start with clef.  You should already have clef installed from your installation of geth tools above.  If you type:

$ which clef

You should see the following output:

/usr/local/ethereum/bin/clef

Now, change to your new clef subdirectory (/Volumes/Ethereum/myEthereum/clef).

You can now execute clef to create a new keystore:

$ clef newaccount --keystore ./keystore

If you are prompted to enter a password, enter an alphanumeric password (remember it).  Once you've created your new keystore, execute clef:

$ clef --keystore /Volumes/Ethereum/clef/keystore --configdir /Volumes/Ethereum/clef/clef --chainid 11155111

That chainid of 11155111 indicates that this is targeting the Sepolia testnet.  If successful, you should see output similar to the following:

WARNING!

Clef is an account management tool. It may, like any software, contain bugs.

Please take care to
- backup your keystore files,
- verify that the keystore(s) can be opened with your password.

Clef is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.

Enter 'ok' to proceed:

[At this point, go ahead and type "ok" and press enter]:

> ok

INFO [05-24|13:36:20.702] Using CLI as UI-channel
INFO [05-24|13:36:20.918] Loaded 4byte database                    embeds=268,621 locals=0 local=./4byte-custom.json
WARN [05-24|13:36:20.979] Failed to open master, rules disabled    err="failed stat on /Volumes/Ethereum/clef/masterseed.json: stat /Volumes/Ethereum/clef/masterseed.json: no such file or directory"
INFO [05-24|13:36:20.979] Starting signer                          chainid=11,155,111 keystore=/Volumes/Ethereum/keystore light-kdf=false advanced=false
INFO [05-24|13:36:21.053] Audit logs configured                    file=audit.log
INFO [05-24|13:36:21.054] IPC endpoint opened                      url=/Volumes/Ethereum/clef/clef.ipc

------- Signer info -------
* intapi_version : 7.0.1
* extapi_version : 6.1.0
* extapi_http : n/a
* extapi_ipc : /Volumes/Ethereum/clef/clef.ipc

------- Available accounts -------
0. 0x793581955c00FB4702ff94Dc2582198a6a4639F8 at keystore:///Volumes/Ethereum/keystore/UTC--2023-04-11T16-13-20.300385000Z--793580955c00fb2509ff94dc2582198a8a4609f8

If you see this type of output (your available accounts will differ), congratulations, you've got clef up and running.  Note that first password (#0): 
0x793581955c00FB4702ff94Dc2582198a6a4639F8That is your new account number.  Your going to need this in a few minutes.

GETH:

Finally, we're going to install geth.  geth is short for go-ethereum, which is an ethereum blockchain client written in the Go programming language.  It's popular, so we're going to use it.  Geth will manage our execution node for us, meaning that it will handle transactions, deployment and execution of smart contracts and also will run the Ethereum Virtual Machine.  We can run geth along with a consensus client (prysm) and it will turn your computer into an Ethereum node (at least for the Sepolia testnet).

Next, we're going to change to our prysm subdirectory:

$ cd /Volumes/Ethereum/ethereum/consensus/prysm

Then, you need to create a JWT secret file.  To do so, go here: seanwasere.com: Generate Random 256 bit 32 Byte Hex and copy the hex number and save it to a file called jwt.hex in your prysm subdirectory.

Now, change to your "execution" subdirectory you created in the MKDIR step above (/Volumes/Ethereum/ethereum/execution).  Execute the following command:

$ geth --sepolia --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret /Volumes/Ethereum/myEthereum/consensus/prysm/jwt.hex --http --http.api eth,net,engine,admin --signer=/Volumes/Ethereum/clef/clef/clef.ipc --http

This will start downloading the blocks in the ethereum testnet Sepolia that are pre-merge.  Depending on your download speed, bandwidth and latency, etc., this could take anywhere from several hours to several days to accomplish.

You can find the starting output here.  As long as your output looks sort of like this file you're on your way with geth (don't panic about any errors about post-merge networks and no beacon clients or dropping unsynced nodes or ...that's normal for right now).  Note also that your peercount (see output) will need to increase dramatically (>20) before you really begin to see much progress in downloading the sepolia testnet blockchain.

PRYSM:

Next, we're going to install prysm, which is our Proof-of-Stake Beacon node:

$ cd /Volumes/Ethereum/myEthereum/consensus/prysm

$ curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh

Now, we have to get down the genesis state from the cluster.

Execute:

$ scp [YourLoginID]@linux.cs.uchicago.edu:/home/mark/pub/56605/genesis.ssz .

NOTEIf you do not yet have CS cluster access or login credentials, note the genesis.ssz file has been placed on our course Canvas site under Files/Genesis/genesis.ssz.  Click on Files, then the directory called Genesis, then download the genesis.ssz file to the directory mentioned above.

With our jwt.hex file created above and our newly downloaded prysm.sh script and genesis.ssz, we're now ready to launch our beacon client (NOTE:  change the suggested-fee-recipient to your first (0th) available accounts output from clef above):

./prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --sepolia --suggested-fee-recipient=0x793581955c00FB4702ff94Dc2582198a6a4639F8 --jwt-secret=jwt.hex --genesis-state=genesis.ssz

Note that the suggested fee recipient is modified and bogus.  If you should get an error that gpg is not installed, install it now:

$ brew install gpg

And relaunch prysm as above.  NOTE:  prysm.sh has a bug in that sometimes when it is shut down, the port stays "used".  If you get an error when trying to restart prysm.sh such that "FATAL p2p: Failed to start discovery error=could not create listener: could not listen to UDP: listen udp 0.0.0.0:12000: bind: address already in use", you're just going to have to shut everything down (clef, geth) and reboot your computer.  It sucks and is inexcusable but that's the only way to get prysm restarted.

You can find the starting output here.  As long as your output looks sort of like this file you're on your way with geth (don't panic about any errors such as the following:

ERROR powchain: Unable to process past deposit contract logs, perhaps your execution client is not fully synced error=processPastLogs: no contract code at given address

This is normal (and accurate...your execution client (geth) actually is not full synced!).

RESOURCE Quickstart: Run a node and (optionally) stake ETH using Prysm | Prysm (prylabs.network)

AT THIS POINT, THE SEPOLIA TESTNET SHOULD  BE IN THE PROCESS OF BEING DOWNLOADED.  THIS CAN TAKE SEVERAL DAYS.

You can check on the progress of the download activity by executing the following command in a new window:

$ curl http://localhost:3500/eth/v1/node/syncing | jq

While it's syncing, you will see output like this:

$ curl http://localhost:3500/eth/v1/node/syncing | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   113  100   113    0     0  15458      0 --:--:-- --:--:-- --:--:--  110k
{
  "data": {
    "head_slot": "2879",
    "sync_distance": "2555446",
    "is_syncing": true,
    "is_optimistic": false,
    "el_offline": true
  }
}

While it's still syncing (after waiting a few minutes...or hours...), you will see output like this:

$ curl http://localhost:3500/eth/v1/node/syncing | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   114  100   114    0     0  14096      0 --:--:-- --:--:-- --:--:-- 57000
{
  "data": {
    "head_slot": "816095",
    "sync_distance": "1300241",
    "is_syncing": true,
    "is_optimistic": true,
    "el_offline": true
  }
}

As your testnet is syncing to your local external drive, you will see (if you run the above curl command over and over periodically), several things occurring in the data oputput.  First, the number denoted by the "head_slot" is slowly getting larger.  This indicates your local chain is growing (downloading).  Second, you will notice that the "sync_distance" number is getting smaller, this indicates that as your download of the testnet blockchain advances, you're getting closer and closer to the end of the chain (the "head").  Finally, you will see that the "is_syncing" indicator is "true".  This means that your local chain is indeed downloading and is currently syncing.  Again, it may take days to fully finish syncing.

At the end, when your Sepolia testnet is all 100% synced, you will see output like this (not in color of course):

$ curl http://localhost:3500/eth/v1/node/syncing | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   112  100   112    0     0  29755      0 --:--:-- --:--:-- --:--:--  109k
{
  "data": {
    "head_slot": "2124218",
    "sync_distance": "0",
    "is_syncing": false,

    "is_optimistic": false,
    "el_offline": false
  }
}

Notice that the "head_slot" is a large number (the current head of the testnet blockchain--yours will be slightly larger than the 2124218 number above), and the "sync_distance" is now 0 (indicating there's no blocks left to sync), and "is_syncing" is now set to "false".  This all indicates that you have downloaded the full Sepolia chain.

If you've made it this far, that's far enough for now.  Have a cup of tea.

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
Ethereum Node Quickstart:  Quickstart: Run a node and (optionally) stake ETH using Prysm | Prysm (prylabs.network)

Submitting:


Execute the following command:

ls -laF ~/.bitcoin/* > ~/lab.1.BC.out.txt

ls -laF /Volumes/Ethereum/* > ~/lab.1.ETH.out.txt

Upload your lab.1.BC.out.txt and
lab.1.ETH.out.txt output files to GitHub Classroom according to the instructions below.

In this course, we are going to use GitHub Classroom, a service that makes it easy to create coursework repositories.

Task 1

Get a Guthub account. If you already have a GitHub account, please move on to the next step.

If you do not have a GitHub account please create one one now. You can get an account here: https://github.com/join. We encourage you to use your CNetID as your GitHub account name, if possible. If that name is already taken, try using your CNetID as a prefix in your Github username.

Task 2

Open a browser window and log into Github. We would recommend you connect your local SSH to your GitHub account. This will require you to create an ssh key and add it to your GitHub account. Follow the steps here for creating a new SSH key: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key. Then complete the addition of the key to your account by following the steps here: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account#adding-a-new-ssh-key-to-your-account. Note, you will want to leverage the SSH address, NOT the HTTPS address, when setting your local lab directory's upstream remote Git repository; this will be more clear when you accept an invitation link for an assignment.

Task 3

We will be using a repository for each lab. We have provided invitation URLs on Ed Discussion that you will use to request your labs repository. The repository will be called lab#-GITHUB_USERNAME inside our MPCS56605 organization on GitHub. For example, for Lab1, if your GitHub username is jdoe, the repository will be called lab1-jdoe. This repository will be private, and can only be viewed by you and the MPCS56605 course staff.

When you open the invitation URL in a browser tab, you will have to complete the following steps:

Github may ask you to grant permission for GitHub Classroom to have access to your GitHub account. If you are asked this question, you should say yes and grant access to Github Classroom.
You must click “Accept this assignment” or your repository will not actually be created. Do not skip this step!
If you run into any issues, please ask for help.