Newbie Getting Started

I had not heard of Algorand until a week before the first auction when I happened across a vblog by Ivan on Tech where he discussed the Algorand forkless blockchain technology and the upcoming auction. Suffering from a sudden dose of FOMO, I set up a wallet on https://auctions.algorand.foundation, bought some USD and sent them to the auction wallet.

My bank did not like that at all. It seems that CoinList raises red flags with banks in Oz, so I received a phone call from the bank almost immediately. I was grilled a bit: did I phone the organization, what research did I do and so on. I managed to convince the bank to let it through because, “as a programmer, I was conducting some research into the technology and I really want to participate”.

After the phone call from the bank, I nervously waited to see my new USD arrive in my wallet. The $$ did arrive to my great relief, but only the day before the auction. So I immediately committed them to the next day’s auction (the first auction).

History shows that the auction completed early with great participation and my purchased Algos arrived in my wallet a week later. Since I jumped in rather hastily, I had to start learning more about Algo World rather than just leaving my Algos sitting in a wallet. The proper way to enter would have been to get involved a year or more ago on DevNet, but you don’t know what you don’t know.

So, where to go?

First of all, after the auction, there is nothing more to see on the auction site, so I scoped around and found the Algorand application (Algo Wallet) on the Apple app store for my iPhone. Eventually, I worked out how to get my auction account into the app (if there is a manual on the app, I don’t know where it is, but there are so few options in the app that pressing buttons eventually gets to Add New Account). The QRCode scanning function proved useful for that bit. Fortunately, I had saved every bit of information that was presented during setup of my first wallet, including an image of the QRCode and 25 word phrase. So, in the app I could see my auction account. I was expecting it to show the Algos I’d bought in the auction. However, there was more in there than I had purchased at auction and I sort of clued in after watching Silvio’s presentation https://www.youtube.com/watch?v=NykZ-ZSKkxM&t=243s that my Algos are already participating.

I’ve gone deeper and set up a MainNet node on Ubuntu 18.04, which is an experience in itself. I’ll discuss that process in a follow-up post.

Gary Thanks for sharing. On the Ubuntu install, did you have permission issues? Also we have developer information on developer.algorand.com that may interest you.

Hi Jason, Indeed I did have permission issues. They continue to crop up now and again. For some reason, new participation keys get root:root and this has to be changed manually to gary:nogroup before it can be seen or used.

After rebooting the server this morning, the node would not start, so I took the sledgehammer approach of changing everything in /var/lib/algorand from algorand:nogroup to gary:nogroup (the installer created the user ‘algorand’) and the node started correctly (at least the default account appears to be participating and ‘goal node status’ is reporting correctly, so I assume the node is running correctly).

I promised to follow up on my initial post with a ‘how to get started’. Here it is.

Install Ubuntu

Install the server edition of Ubuntu on the server machine. An Algorand node does not need a GUI (the Algorand tool ‘goal’ is a command line tool) and administration of the server can be done remotely via SSH in a terminal session on any Mac or Windows machine. Leaving out the GUI leaves processing capacity for more useful programs.

Partition Configuration on Multiple Disks

The configuration chosen for the partitions is not of much significance when setting up an Algorand node, so if the server has only a single disk (or single RAID array), it’s simpler to let the installer use the whole disk.

If the machine has multiple independent disks or RAID arrays, you’d probably want to specify partitions for each disk. Make sure that the root ‘/’ partition is on the first boot device or the system won’t find the boot partition after installation of the OS.

Personally, if I have two disks, I like to specify a SWAP partition of 100GB (minimum size of twice the RAM) on the boot disk first so that the SWAP space is contiguous and, consequently, fast. UNIX OS’s don’t usually use more than twice the RAM size in the SWAP so much of the 100GB will never be used, but given the typical disk size of 1 or more TB, it’s not really a lot of space to potentially have unused.

Then I specify a root (‘/’) partition and ‘/var’ on the boot disk (roughly 50% of the disk size each) and ‘/home’ and ‘/usr’ on the second disk (roughly 50% of the disk each).

Configuring the IP Address

Note that changing the IP addressing in the installer from DHCP to manual (static) will cause the installer to loop back to the language selection page if you add anything to the domain search field and you’ll be right back at the beginning. You can change anything else in the IP configuration page though. It’s a bug everybody seems to be encountering with the installer in 18.04.2 and leaving the domain search field blank is the only thing I’ve found that will avoid the issue.

Post Ubuntu Installation

After installing the OS, log in and run an upgrade (use ‘sudo’ to run as root):

gary@pond : ~ $ sudo apt-get upgrade
[sudo] password for gary:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages will be upgraded:

140 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 55.5 MB of archives.
After this operation, 3,621 kB disk space will be freed.
Do you want to continue? [Y/n]

Once the upgrade is complete, run an update (again using ‘sudo’):

gary@pond : ~ $ sudo apt-get update
[sudo] password for gary:
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 252 kB in 3s (72.2 kB/s)
Reading package lists… Done

Installing Algorand

There is a comprehensive set of documents on the Algorand suite here:
https://developer.algorand.org/docs/introduction-installing-node

The problem I find with this kind of documentation is that, without examples, the documentation only makes sense once you know how a given command works (which is why I’m blogging this). It’s a kind of chicken and egg situation.

Get some prerequisite packages:

gary@pond : ~ $ sudo apt-get install -y gnupg2 curl software-properties-common
Reading package lists… Done
Building dependency tree
Reading state information… Done
curl is already the newest version (7.58.0-2ubuntu3.7).
software-properties-common is already the newest version (0.96.24.32.9).
The following NEW packages will be installed:
gnupg2
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,668 B of archives.
After this operation, 52.2 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 gnupg2 all 2.2.4-1ubuntu1.2 [4,668 B]
Fetched 4,668 B in 1s (4,655 B/s)
Selecting previously unselected package gnupg2.
(Reading database … 66981 files and directories currently installed.)
Preparing to unpack …/gnupg2_2.2.4-1ubuntu1.2_all.deb …
Unpacking gnupg2 (2.2.4-1ubuntu1.2) …
Setting up gnupg2 (2.2.4-1ubuntu1.2) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …

Get the Algorand public key:

gary@pond : ~ $ sudo apt-key adv --fetch-keys https://releases.algorand.com/key.pub
Executing: /tmp/apt-key-gpghome.BUp8x6TnWL/gpg.1.sh --fetch-keys https://releases.algorand.com/key.pub
gpg: requesting key from ‘https://releases.algorand.com/key.pub
gpg: key EDACD29DA10A4EA6: public key “Algorand developers dev@algorand.com” imported
gpg: Total number processed: 1
gpg: imported: 1

Add the Alogrand repository to the local library:

gary@pond : ~ $ sudo add-apt-repository "deb https://releases.algorand.com/deb/ stable main"
Get:1 https://releases.algorand.com/deb stable InRelease [4,121 B]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 https://releases.algorand.com/deb stable/main amd64 Packages [501 B]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 257 kB in 3s (90.7 kB/s)
Reading package lists… Done

Update the sources list:

gary@pond : ~ $ sudo apt-get update
Hit:1 https://releases.algorand.com/deb stable InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 252 kB in 4s (70.6 kB/s)
Reading package lists… Done

Finally, install Algorand connecting to MainNet (default):

gary@pond : ~ $ sudo apt-get install -y algorand
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
algorand
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 87.4 MB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 https://releases.algorand.com/deb stable/main amd64 algorand amd64 1.0.27 [87.4 MB]
Fetched 87.4 MB in 36s (2,403 kB/s)
Selecting previously unselected package algorand.
(Reading database … 66988 files and directories currently installed.)
Preparing to unpack …/algorand_1.0.27_amd64.deb …
Unpacking algorand (1.0.27) …
Setting up algorand (1.0.27) …
Created symlink /etc/systemd/system/multi-user.target.wants/algorand.service → /lib/systemd/system/algorand.service.

Verify the Algo Daemon:

gary@pond : ~ $ algod -v
4294967323
1.0.27.stable [rel/stable] (commit #ee904b7b)
go-algorand is licensed with AGPLv3.0
source code available at https://github.com/algorand/go-algorand

At this point, the node is installed and running, although it is free-wheeling (not attached to any wallet or account). Examine the status of the node using the ‘node status’ command of ‘goal’ (do not use ‘sudo’ when executing ‘goal’):

gary@pond : ~ $ goal node status -d /var/lib/algorand
Last committed block: 14080
Time since last block: 0.0s
Sync Time: 310.2s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Round for next consensus protocol: 14081
Next consensus protocol supported: true
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=

Node Directory Variable Setting

Executing ‘goal’ commands is simplified by setting the environment variable ALGORAND_DATA to the location of the node directory (‘/var/lib/algorand’ by default). This will negate the need to use the -d command line option with every ‘goal’ command. I achieved this by adding one line at the end of the ~/.bashrc file:

41%20pm

After logging back in, the -d option can be omitted from ‘goal’ commands requiring ‘-d /var/lib/algorand’ (the node directory).

File Permissions

In the current version of the Algorand installer, there is a bug with the permission settings that make the main node directory unavailable to the logged in user. This is illustrated here:

gary@pond : ~ $ ls -laR /var/lib/algorand
/var/lib/algorand:
total 401540
drwxrwxr-x 5 algorand root 4096 Jul 5 05:09 .
drwxr-xr-x 36 root root 4096 Jul 5 05:08
-rw-r–r-- 1 algorand nogroup 351597978 Jul 5 06:27 agreement.cdv
-rw------- 1 algorand nogroup 0 Jul 5 05:09 algod.lock
-rw-r–r-- 1 algorand nogroup 15 Jul 5 05:09 algod.net
-rw-r–r-- 1 algorand nogroup 6 Jul 5 05:09 algod.pid
-rw-r–r-- 1 algorand nogroup 64 Jul 5 05:09 algod.token
drwxr-xr-x 2 algorand nogroup 4096 Jul 5 05:09 .algorand
-rw-rw-r-- 1 algorand root 1340 Jun 20 15:42 config.json.example
drwxrwxr-x 5 algorand root 4096 Jul 5 05:08 genesis
-rw-rw-r-- 1 algorand root 24972 Jun 20 15:42 genesis.json
drwx------ 2 algorand nogroup 4096 Jul 5 05:09 mainnet-v1.0
-rw-r–r-- 1 algorand nogroup 59494851 Jul 5 06:27 node.log
-rw-rw-r-- 1 algorand root 23 Jun 20 15:42 system.json

/var/lib/algorand/.algorand:
total 12
drwxr-xr-x 2 algorand nogroup 4096 Jul 5 05:09 .
drwxrwxr-x 5 algorand root 4096 Jul 5 05:09
-rw-r–r-- 1 algorand nogroup 157 Jul 5 05:09 logging.config

/var/lib/algorand/genesis:
total 20
drwxrwxr-x 5 algorand root 4096 Jul 5 05:08 .
drwxrwxr-x 5 algorand root 4096 Jul 5 05:09
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 devnet
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 mainnet
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 testnet

/var/lib/algorand/genesis/devnet:
total 20
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 .
drwxrwxr-x 5 algorand root 4096 Jul 5 05:08
-rw-rw-r-- 1 algorand root 8859 Jun 20 15:42 genesis.json

/var/lib/algorand/genesis/mainnet:
total 36
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 .
drwxrwxr-x 5 algorand root 4096 Jul 5 05:08
-rw-rw-r-- 1 algorand root 24972 Jun 20 15:42 genesis.json

/var/lib/algorand/genesis/testnet:
total 44
drwxrwxr-x 2 algorand root 4096 Jul 5 05:08 .
drwxrwxr-x 5 algorand root 4096 Jul 5 05:08
-rw-rw-r-- 1 algorand root 34754 Jun 20 15:42 genesis.json
ls: cannot open directory ‘/var/lib/algorand/mainnet-v1.0’: Permission denied

Access to ‘/var/lib/algorand/mainnet-v1.0’ is critical to successful use of the ‘goal’ command for creating wallets, creating and importing addresses, creating participation keys and the like and even starting the Algo daemon ‘algod’ on reboot. To overcome the permissions issues, with ‘sudo chgrp’ and ‘sudo chown’, change the owner:group file permissions to <user>:nogroup for all files and directories in ‘/var/lib/algorand’ (there is probably a better way to address this issue, but this is the solution that has worked for me):

gary@pond : ~ $ sudo chown -R gary /var/lib/algorand
[sudo] password for gary:
gary@pond : ~ $ sudo chgrp -R nogroup /var/lib/algorand
gary@pond : ~ $ ls -laR /var/lib/algorand
/var/lib/algorand:
total 466036
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:09 .
drwxr-xr-x 36 root root 4096 Jul 5 05:08
-rw-r–r-- 1 gary nogroup 408080237 Jul 5 06:39 agreement.cdv
-rw------- 1 gary nogroup 0 Jul 5 05:09 algod.lock
-rw-r–r-- 1 gary nogroup 15 Jul 5 05:09 algod.net
-rw-r–r-- 1 gary nogroup 6 Jul 5 05:09 algod.pid
-rw-r–r-- 1 gary nogroup 64 Jul 5 05:09 algod.token
drwxr-xr-x 2 gary nogroup 4096 Jul 5 05:09 .algorand
-rw-rw-r-- 1 gary nogroup 1340 Jun 20 15:42 config.json.example
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:08 genesis
-rw-rw-r-- 1 gary nogroup 24972 Jun 20 15:42 genesis.json
drwx------ 2 gary nogroup 4096 Jul 5 05:09 mainnet-v1.0
-rw-r–r-- 1 gary nogroup 69062238 Jul 5 06:39 node.log
-rw-rw-r-- 1 gary nogroup 23 Jun 20 15:42 system.json

/var/lib/algorand/.algorand:
total 12
drwxr-xr-x 2 gary nogroup 4096 Jul 5 05:09 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:09
-rw-r–r-- 1 gary nogroup 157 Jul 5 05:09 logging.config

/var/lib/algorand/genesis:
total 20
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:08 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:09
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 devnet
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 mainnet
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 testnet

/var/lib/algorand/genesis/devnet:
total 20
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:08
-rw-rw-r-- 1 gary nogroup 8859 Jun 20 15:42 genesis.json
/var/lib/algorand/genesis/mainnet:

total 36
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:08
-rw-rw-r-- 1 gary nogroup 24972 Jun 20 15:42 genesis.json

/var/lib/algorand/genesis/testnet:
total 44
drwxrwxr-x 2 gary nogroup 4096 Jul 5 05:08 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:08
-rw-rw-r-- 1 gary nogroup 34754 Jun 20 15:42 genesis.json

/var/lib/algorand/mainnet-v1.0:
total 27364
drwx------ 2 gary nogroup 4096 Jul 5 05:09 .
drwxrwxr-x 5 gary nogroup 4096 Jul 5 05:09
-rw-r–r-- 1 gary nogroup 4096 Jul 5 05:09 crash.sqlite
-rw-r–r-- 1 gary nogroup 32768 Jul 5 05:09 crash.sqlite-shm
-rw-r–r-- 1 gary nogroup 8272 Jul 5 05:09 crash.sqlite-wal
-rw-r–r-- 1 gary nogroup 17453056 Jul 5 06:39 ledger.block.sqlite
-rw-r–r-- 1 gary nogroup 32768 Jul 5 06:39 ledger.block.sqlite-shm
-rw-r–r-- 1 gary nogroup 5026432 Jul 5 06:39 ledger.block.sqlite-wal
-rw-r–r-- 1 gary nogroup 978944 Jul 5 06:37 ledger.tracker.sqlite
-rw-r–r-- 1 gary nogroup 32768 Jul 5 06:39 ledger.tracker.sqlite-shm
-rw-r–r-- 1 gary nogroup 4420792 Jul 5 06:39 ledger.tracker.sqlite-wal

Create a Wallet

A wallet is simply a conceptual container for accounts. I have not succeeded in importing an existing wallet (I haven’t decoded the command syntax), but it is possible to import accounts to a locally created wallet. The advantage is that you probably already have an account with Algos in it and rather than transfer Algos from some other account to a locally created account and incur transaction costs, you simply import the already cashed up account. The disadvantage is that while backing up the local wallet automatically includes local accounts, it does not backup imported accounts.

To create a wallet, use the ‘goal wallet new’ command (I’ve named this new wallet ‘pond’):

gary@pond : ~ $ goal wallet new 'pond’
Please choose a password for wallet ‘pond’:
Please confirm the password:
Creating wallet…
Created wallet ‘pond’
Your new wallet has a backup phrase that can be used for recovery.
Keeping this backup phrase safe is extremely important.
Would you like to see it now? (Y/n): Y
Your backup phrase is printed below.
Keep this information safe – never share it with anyone!

** Record the mnemonic for the wallet. **

Import a Cashed Up Account

Now import your cashed up account:

gary@pond : ~ $ goal account import -f -m ‘answer pleasant dry … fool seminal …’ -w 'pond’
Please enter the password for wallet ‘pond’:
Imported 2MDITZS63S…

Note that the 25 word mnemonic is for the existing account, not the new wallet. In my case, I imported the account into which the proceeds from the auction were placed.

Review the account to ensure that the funds you expected to see are present:

gary@pond : ~ $ goal account list
Please enter the password for wallet ‘pond’:
[offline] Unnamed-0 2MDITZS63S… 500000000 microAlgos *Default

You might want to rename the imported account to something other than ‘Unnamed-0’:

gary@pond : ~ $ goal account rename ‘Unnamed-0’ 'Auction’
Renamed account ‘Unnamed-0’ to ‘Auction’

Bringing the Account Online

In order to bring the account online as a participating account, a participation key must be created. To create a participation key, you need to know the current round (so far I have found that you can only begin participation if the current ‘Round’ is within the range you set for the participation key). A number of commands will show the current round, one of which is ‘node status’:

gary@pond : ~ $ goal node status
Last committed block: 360704
Time since last block: 0.0s
Sync Time: 425.9s
Last consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Next consensus protocol: https://github.com/algorandfoundation/specs/tree/5615adc36bad610c7f165fa2967f4ecfa75125f0
Round for next consensus protocol: 360705
Next consensus protocol supported: true
Genesis ID: mainnet-v1.0
Genesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=

In this example, the current round was 360705. At the current rate, 3 million rounds would be expected to keep the account participating for 5 ½ to 6 months. So, generating a participation key with a range of 3 million starting at 360800 would look like this:

gary@pond : ~ $ goal account addpartkey -a ‘2MDITZS63S…’ --roundFirstValid 360800 --roundLastValid 3361000 -w 'pond’
WARN[0001] dbatomic(w): tx took 1.299196031s file=dbutil.go function=github.com/algorand/go-algorand/util/db.Accessor.Atomic.func1 line=141
Participation key generation successful

Obviously Warnings are significant and this one was unexpected. I’ll have to explore it a bit more, later. On the surface it looks like an issue with network speed (transaction time). The key was created anyway.

The key will be created in the node’s ‘mainnet-v1.0’ directory:

gary@pond : ~ $ goal account listpartkeys -w 'pool’
Filename Parent address First round Last round First key
2MDITZS63S….360800.3361000.partkey 2MDITZS63S… 360800 3361000 36.0

This system is now ready to participate once the round exceeds the starting value for the key (360800 in this case).

In the time it’s taken me to write this, the current round has come within the range of the participation key, so I can now change the account to online:

gary@pond : ~ $ goal account changeonlinestatus -a ‘2MDITZS63S…’ -o=1 -w 'pond’
Please enter the password for wallet ‘pond’:
Transaction id for status change transaction: H5CTAPYP4L…

All things being equal, your account will go online and will be debited the transaction fee (typically 0.1 Algo cents). Participation rewards will then accumulate in the online account. Actually, if you have Algos in an account, participation rewards accumulate even without a node.

gary@pond : ~ $ goal account rewards -a ‘2MDITZS63S…’ -w 'pond’
2102044 microAlgos

As an aside (and this is only what I have observed), if an account is already participating at a node (it’s online), as soon as you add it to a new wallet on some other node (such as this one just built), it is reported as being online and it can’t be brought online again (at least until the original participation key expires). I am not familiar with how the Algorand blockchain is coded, but it would be logical for the system to immediately recognise accounts that are already online.

1 Like

This is a fantastic guide! I have been able to do everything in it except for this.

Can you walk me through how to do this on ubuntu 18?

Hello AlGod,

I’ve edited the blog.There was an image missing in that area and a brief explanation around editing ~/.bashrc. Have a look back in there.

I use ‘vi’ for editing, but it is not for everybody (‘vi’ has it’s own, non-intuitive command structure, but I’ve been using it for more than 30 years). There are better editors available for those who prefer a more intuitive user interface.

Gary

Thanks, I added the lines as you specified above. used my ordinary text editor to save the file… it saved the file but the commands still require -d. Do I need to restart the computer?

Just log out and log back in. ~/.bashrc is only read once on login.

Garry,

Thanks a bunch! this is really helpful.

Awesome guide, Gary! :smiley:

Thanks Evan. I appreciate the comment. We all succeed through knowledge sharing.