There is a growing common interest on the Infinite Conversations/Cosmos site to explore e-governance and e-currencies, and we have had a number of fruitful exchanges with developers of Holochain and also the CoGov modules that are being built in relation to Holochain. Over the past few weeks I downloaded the development environment for Holochain to my computer and have been working my way through the tutorials in order to begin experimenting with the environment. Several others have expressed interest in doing this also. In addition, there are ongoing discussions about its relationship to other e-governance and e-currency initiatives such as blockchain and bitcoin. So I propose to use this thread to support our learning efforts but also to encourage further discussion about these issues.
I am working on a Mac - unfortunately, those on Windows computers will have different issues. However, I propose to expose some of my “teething issues” here, and try to keep separate Mac issues from Unix, Holochain and CoGov issues.
Basically, to get Holochain up and running on my computer, I went to the Holochain.org website and selected the menu item “Get Started”. They provide detailed instructions for downloading the code for each type of platform. Holochain is built inside a kind of extended programming environment called github.com - it is essentially a community of developers working across a broad range of projects of which Holochain is only one. Once github is installed, you are then ready to download the holochain code itself.
Mac issues on downloading and installing
My primary problems were all related to the fact that I have not really done any Unix work in decades. The MacOS is built on top of Unix. For most users, this fact is simply an obscure issue they pay no attention to, but it means that the Mac is also a powerful Unix computer. To access the Unix environment, you need to use a Utility app built into the Mac called “Terminal”. Terminal gives you access to a command line interpreter for Unix (where you type commands in to do stuff, instead of using the mouse).
The terminal screen looks like this :
It basically allows you to access the directory structure of your Mac using typed instructions. In Unix, of course, there are standard ways of doing this. When you first get onto Terminal and open a window, you get something like this :
It’s a bit daunting!
if you type in “pwd” the system tells you what directory you are in (present working directory, or something like that).
So it tells me that I am in the Users directory in the subdirectory with my name. My computer has more than one account, hence that location.
To get stuff installed, you are going to have to be in the root directory. To get there, you use the “cd” (change directory) command. The simplest way to do this is to use, in the example I have given, “cd …” twice. “cd …” tells Unix to move up a level in the directory structure.
So now I am at the root level.
The instructions for holochain will install holochain, by default into a set of directories and subdirectories that it creates for you. But the instruction also tell you to make some changes to some of the root files, which is why I have shown you how to get there. In particular, you are asked to change the “.bash_profile” file. File names that begin with a “.” are normally hidden in Unix. A command such as “ls” will give you a list of all the files in the directory, but won’t always show the hidden files.
Now, to get into a file, you are going to need an editor. Fortunately, Unix has a number of built-in editors you can use. The simplest is something called “vi”, although it has been updated, and is now called “vim”. You simply type “vim” and the name of the file you either want to create or want to edit (if it is an existing file), and, presto, you are inside the editor. You need to find some documentation on vim to use it properly, however (here is a pdf manual I quite like - I find a pdf file useful in a manual since I don’t have multiple screens on my computer so having everything on line can be awkward flipping between different windows). I just hunted around on the web for a manual, my vim skills had gotten rusty!
Anyway, I made the changes asked for by the holochain installation instructions, but I did something really stupid. The two lines they want you to put into the “.bash_profile” file include quotation marks. I typed in my usual quotation marks, and went ahead with the process, and the thing stalled. Worse, you had to run “bash” to get everything working, and the program just hung - it wouldn’t take any commands or do anything at all. So I spent a considerable amount of time reading up on “shells” (bash is a Unix shell - a separate command line environment from the default one Unix uses when you first come into it, with somewhat different commands), Unix commands, what have you. I was stuck. So I emailed Ray Powell and he pointed out, when I sent him a copy of my code, that I had used “smart quotes” and not basic quotes. Of course the compiler doesn’t recognize smart quotes! Problem fixed, and everything went forward again.
As I mentioned above, running bash means that not all the Unix commands I knew worked the way I expected them to. So I hunted around on the net and found someone who had developed an extensive “.bash_profile” that provides all the right aliases I needed to work the way I expected to *see Nathaniel Landau’s page. If you are new to Unix, this probably isn’t very useful - for me it was a godsend, since without it, all my ‘reflexes’ were wrong. The rather extensive lists you see in the first Terminal image are the results of this extended .bash_profile running in the background - it lists files even when I just hit a carriage return.
I had some debugging to do - missing commas, etc. - all programming environments require you to check character by character what you have done, and it’s easy to omit something or make a small mistake copying.
The HoloWorld tutorial (essentially the first tutorial they propose) is quite extensive. There are some structural issues. I was reminded of a Jane Siberry song “what you do over here, you have to do over there”. You make changes to one file but you have to make appropriate and matching changes to another file. It’s okay when you are following a tutorial, but when you are developing a new programme yourself, you are going to have to keep track of these things.
At the end of the HoloWorld tutorial, you are asked to run code which opens a port (“4141”). Don’t forget to do this in your browser - open a page at the address “http://localhost:4141”. I forgot to do this and the program hung again in the Terminal window. To break out of a “hung” program, press “Control-C”.
More Unix issues
By now it should be apparent you will also need a primer on Unix commands if you are working in this environment. There are lots around (here’s one that I find useful), and you can always type “help” in directly in Unix and get a list of acceptable commands.
By the time you have HoloWorld up, you now have a deep directory structure. Mine is “~/go/src/github.com/holochain/holochain-proto/testApps/holoWorld” to give you an idea. Since when you sign onto a new Terminal window you enter near the root directory, it is awkward and time consuming to type this long directory in every time (there are other tricks however that simplify the process). So I re-entered the “.bash_profile” file and added new aliases that assigned these long commands to “cdholo” and “cdhw”, so that’s all I have to type in now to get to the right directory.
I think that covers things for my first programming issues in relation to Holochain. I think one needs to work through several tutorials to really begin to understand how to program in Holochain. I will let you know how that goes.