How to do a Gitian Build for Litecoin - Tutorial - CoinAxis

How to do a Gitian Build for Litecoin - Tutorial - CoinAxis

Overview

For developers, one of the most important things you can do to help litecoin, is to do gitian builds of litecoin.  It helps elminate the single point of failure, with centralized software builds.  This distributes the verification amongst multiple litecoin builders.  

Gitian is a secure source-control oriented software distribution method. This means you can download trusted binaries that are verified by multiple builders.
Gitian uses a deterministic build process to allow multiple builders to create identical binaries. This allows multiple parties to sign the resulting binaries, guaranteeing that the binaries and tool chain were not tampered with and that the same source was used. It remove the build and distribution process as a single point of failure.  ~ gitian.org

 Prerequisites

There are several important prerequisites you'll need to build litecoin using Gitian-Builder.  The build process runs on a VM (Virtual Machine) on your current Ubuntu OS.  It will take compatible hardware, as well as software.  The build process can be resource intensive, and is best to have enough RAM, and hard disk space.

  • 64 bit compatible hardware.  CPU (Intel VT-x or AMD-V), more info HERE.
  • 64 bit Ubuntu Linux Distribution (Download HERE)

Linux - Ubuntu/64 preparation

Once you've determined you have compatible hardware, and have 64 bit Ubuntu installed, and running.  We'll need to install all of the required dependences to run a Virtual Machine, and run gitian-builder.  This tutorial assumes you have installed required developer packages.  If you receive errors, then you may have to install packages & dependencies not listed herin.

This will install the required packages, and KVM.  Inside the terminal program:

sudo apt-get install git apache2 apt-cacher-ng python-vm-builder ruby
sudo apt-get install qemu-kvm

Download, and prepare Gitian builder, and bitcoin.  In terminal, from your home/user/ directory:

git clone https://github.com/devrandom/gitian-builder.git
git clone https://github.com/bitcoin/bitcoin.git

Now prepare gitian-builder.  We must create a directory to hold the necessary files.

mkdir gitian-builder/inputs
cd gitian-builder/inputs

# Inputs for Linux and Win32:

wget -O miniupnpc-1.6.tar.gz 'http://miniupnp.tuxfamily.org/files/download.php?file=miniupnpc-1.6.tar.gz'
wget 'http://fukuchi.org/works/qrencode/qrencode-3.2.0.tar.bz2'

# Inputs for Win32: (Linux has packages for these)

wget 'https://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2'
wget 'http://www.openssl.org/source/openssl-1.0.1c.tar.gz'
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
wget 'https://downloads.sourceforge.net/project/libpng/zlib/1.2.6/zlib-1.2.6.tar.gz'
wget 'https://downloads.sourceforge.net/project/libpng/libpng15/older-releases/1.5.9/libpng-1.5.9.tar.gz'
wget 'https://download.qt-project.org/archive/qt/4.8/4.8.3/qt-everywhere-opensource-src-4.8.3.tar.gz'
wget 'http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2'
cd ../..

Building the KVM virtual machine

cd gitian-builder

It's time to build our virtual machine.  This process will take some time for each one.  Sit back and relax.

sudo bin/make-base-vm --arch amd64
sudo bin/make-base-vm --arch i386

Once you've created both virtual machines, we can test to see if everything installed properly. 

PATH=$PATH:$(pwd)/libexec
make-clean-vm --suite lucid --arch i386
start-target 32 lucid-i386
on-target ls -la
stop-target
sudo service apt-cacher-ng status
ls -1 /dev/kvm

You should have an output that looks similar to the following:

b2ap3_thumbnail_gitian-Sanity.jpg

 

 

The following will build litecoind, and litecoin-qt on Linux32, and Linux64

cd litecoin
git pull
cd ../gitian-builder
git pull
./bin/gbuild --commit bitcoin=HEAD ../litecoin/contrib/gitian-descriptors/gitian.yml

Inside your gitian-builder/build/out/ directory will be the compiled litecoin distribution.  Make sure you copy these files out of the /build/out directory, as the next build will clear them out automatically.

The following will build litecoind, and litecoin-qt on Win32.  It will be located in the gitian-builder/build/out/ directory.

./bin/gbuild --commit bitcoin=HEAD ../bitcoin/contrib/gitian-descriptors/gitian-win32.yml

 

sudo apt-get install build-essential
sudo apt-get install libssl-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libdb4.8-dev
sudo apt-get install libdb4.8++-dev
sudo apt-get install libminiupnpc-dev

Overview

For developers, one of the most important things you can do to help litecoin, is to do gitian builds of litecoin.  It helps elminate the single point of failure with centralized software builds.  This distributes the verification amongst multiple litecoin builders.  

Gitian is a secure source-control oriented software distribution method. This means you can download trusted binaries that are verified by multiple builders.
Gitian uses a deterministic build process to allow multiple builders to create identical binaries. This allows multiple parties to sign the resulting binaries, guaranteeing that the binaries and tool chain were not tampered with and that the same source was used. It remove the build and distribution process as a single point of failure.  ~ gitian.org

Prerequisites

There are several important prerequisites you'll need to build litecoin using Gitian-Builder.  The build process runs on a VM (Virtual Machine) on your current Ubuntu OS.  It will take compatible hardware, as well as software.  The build process can be resource intensive, and is best to have enough RAM, and hard disk space.  In this tutorial, we will be using the KVM virtual machine.  Others will work, but for simplicity sake, we will be using KVM.

  • 64 bit compatible hardware.  CPU (Intel VT-x or AMD-V), more info HERE.
  • 64 bit Ubuntu Linux Distribution (Download HERE)

Linux - Ubuntu/64 preparation

Once you've determined you have compatible hardware, and have 64 bit Ubuntu installed, and running.  We'll need to install all of the required dependences to run a Virtual Machine, and run gitian-builder.  This tutorial assumes you have installed required developer packages.  If you receive errors, then you may have to install packages & dependencies not listed herin.

This will install the required packages, and KVM.  Inside the terminal program:

sudo apt-get install git apache2 apt-cacher-ng python-vm-builder ruby
sudo apt-get install qemu-kvm

Download, and prepare Gitian builder, and bitcoin.  In terminal, from your home/user/ directory:

git clone https://github.com/devrandom/gitian-builder.git
git clone https://github.com/bitcoin/bitcoin.git

Building the KVM virtual machine

We must create a directory (named inputs) to hold the necessary files.  Then fetch/download the necessary files.

cd gitian-builder
mkdir inputs
cd inputs
wget 'http://miniupnp.free.fr/files/download.php?file=miniupnpc-1.6.tar.gz' -O miniupnpc-1.6.tar.gz
wget 'http://www.openssl.org/source/openssl-1.0.1c.tar.gz'
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
wget 'http://zlib.net/zlib-1.2.6.tar.gz'
wget 'ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.9.tar.gz'
wget 'http://fukuchi.org/works/qrencode/qrencode-3.2.0.tar.bz2'
wget 'http://downloads.sourceforge.net/project/boost/boost/1.50.0/boost_1_50_0.tar.bz2'
wget 'http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz'
wget 'http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2'
cd ..

It's time to build our virtual machine.  This process will take some time for each one (i.e. i386 and amd64).  Sit back and relax.  You should be inside the gitian-builder directory.

sudo bin/make-base-vm -a i386
sudo bin/make-base-vm -a amd64

Once the KVM virtual machine(s) have been built, we can test to make sure they work properly.  In terminal.

PATH=$PATH:$(pwd)/libexec
make-clean-vm --suite lucid --arch i386
start-target 32 lucid-i386
on-target ls -la
stop-target
sudo service apt-cacher-ng status
ls -1 /dev/kvm

You should have an output that looks the image below.  You should now see the files "base-lucid-amd64.qcow2 & base-lucid-i386.qcow2, in the gitian-builder directory.  See below:

b2ap3_thumbnail_gitian-Sanity.jpg  b2ap3_thumbnail_gitian-builder_003.jpg

Gitian-Builder - Compile Linux & Windows distributions - With Signatures

Now we will create additional files that are needed.  They need to be placed into the inputs directory, after each build.  This only needs to be done once on the first run, OR, when dependencies change versions.

./bin/gbuild ../litecoin/contrib/gitian-descriptors/boost-win32.yml
mv build/out/boost-win32-1.50.0-gitian2.zip inputs/
./bin/gbuild ../litecoin/contrib/gitian-descriptors/qt-win32.yml
mv build/out/qt-win32-4.8.3-gitian-r1.zip inputs/
./bin/gbuild ../litecoin/contrib/gitian-descriptors/deps-win32.yml
mv build/out/litecoin-deps-0.0.5.zip inputs/

Adding GPG signatures to your build process helps secure the litecoin distributions.  If you don't already have a GPG key, you can find more information, and instructions here:

From the home/username directory (usually the directory that contains litecoin, gitian-builder, and gitian.sigs.ltc directories)

export SIGNER=(your gitian key, ie bluematt, sipa, etc)
export VERSION=0.8.0
cd ./gitian-builder

Now to compile the litecoin distributions, with your GPG signature.

./bin/gbuild --commit litecoin=v${VERSION} ../litecoin/contrib/gitian-descriptors/gitian.yml
./bin/gsign --signer $SIGNER --release ${VERSION} --destination ../gitian.sigs.ltc/ ../litecoin/contrib/gitian-descriptors/gitian.yml
./bin/gbuild --commit litecoin=v${VERSION} ../litecoin/contrib/gitian-descriptors/gitian-win32.yml
./bin/gsign --signer $SIGNER --release ${VERSION}-win32 --destination ../gitian.sigs.ltc/ ../litecoin/contrib/gitian-descriptors/gitian-win32.yml

 

Rate this blog entry:
3
Inside Bitcoins Returns to Las Vegas Next Week – G...

Related Posts

  • No comments found

Leave your comments

Post comment as a guest

0 / 1000 Character restriction
Your text should be in between 10-1000 characters
Your comments are subject to administrator's moderation.

Popular Articles

How to configure Cgminer to mine bitcoin, and litecoin. System details Motherboard: Gigabyte 990FXA-UD3 Processor: AMD FX 4100 4-Core Processor Memory/RAM: Gskill Ripj...
Rate this blog entry:
21
For those of us Windows (or Apple) users, Linux can be daunting at first.  It's the wild west of operating systems.  In many ways is far superior than it's Microsoft and Apple counterpart...
Rate this blog entry:
12
How to configure Cgminer to mine bitcoin, and litecoin. This seems to be a popular issue with mining crypto-currencies.  There are many nuances to get your mining configuration correct, an...
Rate this blog entry:
10
How to buy Litecoin I often get this question from people interested in litecoin, but don't know exactly how to buy them.  Litecoin is faster version of bitcoin that uses a more memory int...
Rate this blog entry:
14