Truechain Test Network Setup

Source: Internet
Author: User
Tags install go

Installing the system environment

Note: This article operates in a Mac environment.

1. Install go environment (go requires version 1.7 and above)

    1. The MAC executes the command brew install go.
      Encountered by the wall problem, you can open the browser https://studygolang.com/dl/golang/go1.10.3.darwin-amd64.pkg download, and then step by step installation.
    2. Configure the GOPATH environment variable. Execute the following command in turn:
      Execute CD ~
      Implementation of VI. Bash_profile
      Insert a line of your own project directory address in. Bash_profile Export gopath=/
      Sers/edz/go
      Execute Go ENV
      If the output has the same Gopath value as set above, it is set successfully.
1.jpg

2. Configuring the C Compiler

    1. Mac side performs brew install GCC

compiling source files

    1. Download Project Source Https://github.com/truechain/truechain-engineering-code
    2. Enter the project directory. To compile. Execute command: Make Getrue
    3. After the compilation is complete. The path to the Getrue command is the project directory/build/bin/.
    4. Add the Getrue path to the system environment variable
3.jpg

Getrue command

Getrue--help View command Help,

4.jpg

Genesis.json

Create your own test network. You first need to create the network's Genesis state, so that all nodes know and agree to this state.
The Genesis state (or Genesis block) is a small JSON file. Such as

2.jpg
简单介绍一下这个genesis.jsonchainId    链的IDalloc      系统自带的两个地址及余额coinbase   矿工工号difficulty 挖矿难度extraData  扩展字段gasLimit   交易手续费nonce      随机字符串,用于挖矿mixhash    配合nonce进行挖矿parentHash 上一个区块的哈希timestamp  区块生成的时间

Build a test network

Step1. Set up the test directory. For example, test

Step2. Refer to the source code in the Cmd/getrue Genesis.json file, the contents of the file are as follows.

 {  "config": {        "chainId": 10,        "homesteadBlock": 0,        "eip155Block": 0,        "eip158Block": 0    },  "alloc"      : {      "0x970e8128ab834e8eac17ab8e3812f010678cf791" : { "balance" : "90000000000000000000000"},      "0x68f2517b6c597ede0ae7c0559cdd4a84fd08c928" : { "balance" : "10000000000000000000000"}      },  "coinbase"   : "0x0000000000000000000000000000000000000000",  "difficulty" : "0x200",  "extraData"  : "",  "gasLimit"   : "0x2fefd8",  "nonce"      : "0x0000000000000042",  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",  "timestamp"  : "0x00"}

Step3. Create a Genesis block. Execute the following command

Getrue--datadir Test Init Path/to/cmd/getrue/genesis.json

The--datadir is used to specify the directory. When the above command finishes, the directory has more than Getrue and KeyStore two folders. Getrue folder is used to store the relevant data of the chain, KeyStore folder is stored in the chain of user information

Step4. Start the test chain start node. Execute the following command
Getrue--datadir Test--nodiscover console 2>>getrue.log

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.