Installing and setting up Loom on Ubuntu

Ubuntu Packages

sudo apt -y install curl unzip make git

Golang

The official way

curl -O https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz

Assuming you are on bash, if zsh do to ~/.zshrc:

echo -e "\nexport PATH=\$PATH:/usr/local/go/bin:~/gopath/bin" >>  ~/.bashrc
source ~/.bashrc

Protobuf

https://github.com/google/protobuf/releases/

export PROTOBUF_VERSION=3.5.1
curl -OL https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
sudo unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d /usr/local
sudo chmod +x /usr/local/bin/protoc

Dep

mkdir -p ~/gopath/bin
export GOPATH=~/gopath
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh

Installation

curl -OL https://downloads.loomx.io/loom/linux/stable/loom
chmod +x loom

export GOPATH=~/gopath
export PATH=$GOPATH/bin:$PATH
./loom spin weave-blueprint
cd blueprint
export GOPATH=$GOPATH:`pwd`
make deps
make
cd build

../../loom init
cp ../genesis.example.json genesis.json

Run Blockchain

../../loom run

Send transactions

Open a second console and run the following commands:

cd blueprint/build
../../loom genkey -k priv_key -a pub_key
./blueprint call create-acct -p priv_key

This will generate a private key and create an account.

Next, let's set a value:

./blueprint call set -v 1 -p priv_key

and read it:

./blueprint call get

You can read the source of the blueprint contract here