Spectrum Chain installation for Linux

RUUR
RUUR
Sep 3, 2018 · 3 min read

This article introduces the basic environment installation of Spectrum chain development in Linux environment, including Ubuntu and CentOS. At the same time, it also provides a way to create a Docker image. It is recommended to use the docker environment to avoid installation failures due to environmental differences, and rapid deployment.


Install

1. System environment

  • Ubuntu: Ubuntu 16.04.4 LTS
  • CentOS: CentOS Linux release 7.5.1804
  • Docker: Version 18.06.1-ce-mac73 (26764)

Note: The installation process may be slightly different for different Linux distributions.


2. Tool installation
2.1 Installation dependency

  • Ubuntu
$ apt-get install git
$ apt-get install wget
  • CentOS
$ yum install git
$ yum install wget
$ yum -y install gcc automake autoconf libtool make
  • Docker(No need to install Golang separately)
$ docker pull golang
$ docker run -i -t golang /bin/bash
$ go version
go version go1.11 linux/amd64

2.2 Install Golang

  • Version check
$ go version
  • Version support

Golang1.9.2 — Golang1.11 has been tested and supported.

Before installing the project, check if Golang is installed. If you have installed or used Golang Docker image, please ignore the next step (Download and Install)

  • Download and Install
$ wget -c -t 3 https://dl.google.com/go/go1.9.2.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz

2. Setting environment variables

Run

$ export GOROOT=/usr/local/go
$ export PATH=$GOROOT/bin:$PATH

You can also add environment variables to the profile file, add the above environment variables to the $HOME/.profile file, and execute source $HOME/.profile.

  • Check the version again

Run

$ go version

Results are as follows

go version go1.9.2 linux/amd64

The Golang installation process is as follows


3. Spectrum chain installation

3.1 Download source file

$ git clone https://github.com/SmartMeshFoundation/Spectrum.git

3.2 Build

$ cd Spectrum
$ make smc

3.3 Get result

Done building.
Run "/your_path/Spectrum/build/bin/smc" to launch smc.

The Spectrum chain installation process is as follows


Run

1. Run fast node to test smc

$ /your_path/Spectrum/build/bin/smc console

Note: /your_path/ indicates the system path where the Spectrum project code is located.

Run the Spectrum chain as follows

2. Create new account

> personal.newAccount()

Create new account as follows

3. View the miner nodes

> tribe.getStatus()

View the miner nodes as follows:

4. View the block mining history in console

> tribe.getHistory(11,false)

View the block mining history in console as follows


Summary

Completing the above installation process means that the Spectrum chain infrastructure has been successfully installed and can be used for the next development work.
When you execute the /your_path/Spectrum/build/bin/smc console command, you may download a large amount of Spectrum chain data synchronously, which may take tens of minutes to several hours (depending on the network).
In addition, please ensure that the system environment has enough space to complete the download and update of data. The data storage path is ~/.spectrum/smc/chaindata/. To remove the project, delete the data file synchronously. The operation command is: rm -rf ~/.spectrum.

SmartMesh Developer Community

Welcome to contribute, have the opportunity to get SMT rewards, and be invited to join smartmesh developer community.

RUUR

Written by

RUUR

Python,React,Mongodb

SmartMesh Developer Community

Welcome to contribute, have the opportunity to get SMT rewards, and be invited to join smartmesh developer community.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade