Table of Contents

Using Hyperledger Sawtooth on FreeBSD 11.1

Status

Hyperledger Sawtooth is a modular blockchain platform for building, deploying, and running distributed ledgers. Hyperledger Sawtooth doesn't require Docker and Docker-compose compared to other Hyperledger projects.

This quick and dirty guide assumes you running as root. There are some packages that needs to be installed beforehand in FreeBSD. Also this guide will help you install python packages system wide (Warning: maybe better use virtual environment in production!). It is also possible to try these instructions using FreeBSD jail.

Another interesting thing to try is how Proof of Elapsed Time (PoET) consensus works with Intel SGX. More info about PoET and SGX at:

https://sawtooth.hyperledger.org/docs/core/releases/latest/architecture/poet.html

As for SGX support in FreeBSD, it was brought and committed by br@ in CURRENT.

Install necessary packages

Install following packages using pkg install as root:

pkg install -y git node npm python3 go protobuf pkgconf autoconf libtool
pkg install -y py36-setuptools py36-pip py36-yaml

Install python3 packages

Sawtooth needs several python3 modules, so install them using pip-3.6:

pip-3.6 install colorlog zmq toml netifaces pyformance cbor lmdb aiohttp requests bitcoin secp256k1

Install gprcio and gprcio-tools

There are 2 important ports (thanks to vanilla@) required for Sawtooth are:

devel/py-grpcio
devel/py-grpcio-tools

Can be installed either via pkg (a) or ports (b).

a. Install via pkg

pkg install -y py36-grpcio py36-grpcio-tools

b. Install via ports

If you don't have /usr/ports yet, then you can use portsnap to fetch:

portsnap fetch update     ### or portsnap fetch && portsnap extract

py-grpcio and py-grpcio-tools ports are required to build/install until corresponding packages will be available:

cd /usr/ports/devel/py-grpcio
PYTHON_VERSION=3.6 make install clean
cd /usr/ports/devel/py-grpcio-tools
PYTHON_VERSION=3.6 make install clean

Get Sawtooth and run

Now clone Sawtooth repo from github:

cd $HOME
git clone https://github.com/hyperledger/sawtooth-core.git
cd sawtooth-core

If it is necessary then set PATH to ${PATH}:${HOME}/sawtooth-core/bin for environment.

Install sawtooh_cli and sawtooth_sdk related python modules:

cd cli
python3.6 setup.py build
python3.6 setup.py install
python3.6 setup.py install_lib
cd ..
cd sdk/python
python3.6 setup.py build
python3.6 setup.py install
python3.6 setup.py install_lib
cd ../..

Now that grpcio, grpcio-tools are installed, the protobuf files need to be generated. The protogen script generates python classes based on the proto files found in the protos directory. Assuming you are in sawtooth-core directory run:

bin/protogen

If everything is correctly installed it should run without any error.

Now follow the guide at:

https://sawtooth.hyperledger.org/docs/core/releases/latest/app_developers_guide/ubuntu.html#creating-the-genesis-block

to create genesis block and start necessary processes like validator etc.

It may require some more testing, however that's it for now.

You may also try sample proof of concept codes for distributing ipfw rules on blockchain network at:

https://github.com/tsgan/sawtooth-core-ipfw

Enjoy running blockchain network using FreeBSD.

Any improvements or suggestions are welcome.