Ubuntu System builds Ethereum private chain

Source: Internet
Author: User
Tags curl install go

1. Install curl, git

Apt-get Update

Apt-get Install git

Apt-get Install Curl

2. Install Go

Curl-o https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz

Unpack it to the/usr/local (might require Sudo)

Tar-c/usr/local-xzf go1.5.1.linux-amd64.tar.gz

3, configure the GO environment variable

Mkdir-p ~/go; echo "Export gopath= $HOME/go" >> ~/.BASHRC

echo "Export path= $PATH: $HOME/go/bin:/usr/local/go/bin" >> ~/.BASHRC

SOURCE ~/.BASHRC

Verify go:

Go version

4, Nodejs, NPM

CURL-SL https://deb.nodesource.com/setup_4.x | SUDO-E Bash-

Apt-get Install Nodejs

Verify that the installation is successful

Node-v

Npm-v

5. Installation of Ethereum Environment

sudo apt-get install Software-properties-common

sudo add-apt-repository-y ppa:ethereum/ethereum

sudo add-apt-repository-y Ppa:ethereum/ethereum-dev

sudo apt-get update

sudo apt-get install Ethereum

6, install SOLC (solidity compilation environment)

sudo add-apt-repository ppa:ethereum/ethereum

sudo apt-get update

sudo apt-get install Solc

7. Creation of three accounts

Input three consecutive commands: Geth account New

Get three public key addresses

8. Edit the Genesis block file

Put three addresses in "Alloc",

{    "nonce": "0x0000000000000042",    "difficulty": "0x1",    "Alloc": {        " 0d2e08a2615d5c46734058f34b307db0eda5ba6e ": {            " balance ":" 20000009800000000000000000000 "        },        " 1f9035c1ed2802fe7f96e8a28890d8816af14c9c ": {            " balance ":" 20000009800000000000000000000 "        },        " 59b0a1db6b4de1d303d440da1d02fafd3f4f41af ": {            " balance ":" 20000009800000000000000000000 "        }    },  "Config": {"Chainid": "Homesteadblock": 0, "Eip155block": 0, "Eip158block": 0},"Mixhash": " 0x0000000000000000000000000000000000000000000000000000000000000000 "," Coinbase ":" 0x0000000000000000000000000000000000000000 "," timestamp ":" 0x00 "," Parenthash ":" 0x0000000000000000000000000000000000000000000000000000000000000000 "," Extradata ":" 0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa "," Gaslimit ":" 0xb2d05e00 "}

Note: If you do not add the dash section, the following error will occur:

9. Configure the script to unlock the account automatically

Create the password file under./ethereum, enter the password in it, and each account has a password such as:

123456123456123456

10. Configure Ethereum Startup script private_blockchain.sh (name pickup)

Geth--rpc--rpcaddr= "0.0.0.0"--rpccorsdomain= "*"--unlock ' 0,1,2 '--password ~/.ethereum/password   --nodiscover- -maxpeers ' 5 '--networkid ' 1234574 '--datadir ' ~/.ethereum '  console

Each time you start the Geth node, you only need to enter a command

Bash private_blockchain.sh

11, after starting, enter Eth.getcompilers (), may appear a situation

This is because the Geth client is automatically downloaded when the Ethereum environment is installed, but there is no getcompilers () function in the version 1.6 client, which may be developed in other ways to implement this functionality.

My solution is to download the geth1.5.9 version, overwriting the original geth.

After that, the input eth.getcompilers () will appear,

This is because the compiler is not specified, another terminal is opened, and the input which SOLC

After that, enter in the Geth terminal:

This is because I use the Ubuntu virtual machine, the memory of my virtual machine is not enough, when I put the virtual machine memory to 2G, this problem solved.

Re-enter:

Done!

Ubuntu System builds Ethereum private chain

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.