Intelligent contract and Dapp based on Nebula chain (i)--build and install the nebula chain

Source: Internet
Author: User
Tags install go

Because of the Nebula Developer Rewards Program, I started experimenting with the development of smart contracts and Dapp. Smart contracts based on the nebula chain use JavaScript or typescript, which is relatively inexpensive compared to ethereum language learning. In the next series of articles, I will record the contents of the Dapp development process and provide some references for interested or interested readers. The content of the previous chapters is based on the official wiki.

Golang Environment Construction

Development environment I use Mac OSX.

Components
Version Description
Golang >=1.9.2 The Go programming Language

In Mac OSX, it is recommended to use homebrew to install Golang

#安装Golangbrew install go#配置环境变量export  GOPATH=/path/to/workspace (根据你自己的情况来配置环境变量)

Hint: In the development of Golang, Gopath is necessary, it specifies Golang development workspace, all the source code should be placed under Gopath. About Golang environment configuration, do not understand the friends can go to search for more detailed tutorials. Finally, complete the installation of Golang must remember to restart the terminal

Compiling the nebula Chain

Download source code

You can use the following instructions to download the latest version of the nebula chain source directly

#创建并进入工作目录mkdir -p $GOPATH/src/github.com/nebulasiocd $GOPATH/src/github.com/nebulasio#下载源码git clone https://github.com/nebulasio/go-nebulas.git# 进入项目目录cd go-nebulas# 切换到最稳定的master分支git checkout master

Tip: In addition to using the GIT command to get the source code, you can also use the Git tool to clone the source code, according to personal preferences to choose the Cloning method

Installing Rocksdb dependent libraries

Can be installed directly on Mac via homebrew

#在终端运行brew install rocksdb

Installing the Go Dependency Library

In Go-nebulas, the three-party library of Go is managed by DEP.

Components
Version Description
Dep >=0.3.1 Dep is a dependency management tool for Go.

Installing the DEP tool

Install and upgrade DEP directly via homebrew

#安装depbrew install dep#更新depbrew upgrade dep

Download go tri-party Library

Switch to the Go-nebulas project root directory, and then use DEP to download the three-party library.

cd $GOPATH/src/github.com/nebulasio/go-nebulasmake dep

Make DEP will download many dependent libraries. In some areas, this process can be time-consuming or direct failure. You can download the vendor.tar.gz directly and use the following instructions to install the Go Dependency library by unpacking the package.

cd $GOPATH/src/github.com/nebulasio/go-nebulaswget http://ory7cn4fx.bkt.clouddn.com/vendor.tar.gztar zxf vendor.tar.gz

Installing the chrome V8 dependency Library

Nebula Virtual machine now relies on Chrome's V8 engine, for the convenience of everyone, Nebula official has compiled the V8 dynamic library. Run the following command to complete the installation.

cd $GOPATH/src/github.com/nebulasio/go-nebulasmake deploy-v8

Hint: If the error in the Linux environment is similar to the "/usr/local/lib/libv8.so:undefined reference to * *", it is because/user/local/lib/is not in your dynamic library index, only to/etc/ ld.so.conf.d/Add file, xxxx.conf can, file content is/user/local/lib. Then execute sudo ldconfig make the changes take effect

Compiling the executable file

After installing all of the above dependent libraries, we can now go into the Go-nebulas root directory to compile the nebula chain executable file.

cd $GOPATH/src/github.com/nebulasio/go-nebulasmake build

After compiling successfully, you will see the following information compiled successfully

Next chapter running a nebula chain

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.