以太坊java私有链搭建_搭建以太坊私有链

一环境准备

1Go-Ethereum

Go-Ethereum是由以太坊基金会提供的官方客户端软件。它是用Go编程语言编写的,简称Geth。可以按照以下wiki说明安装go-ethereum,地址为:https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum。

这里简单介绍一下在mac上通过源码安装的步骤:

1)下载geth源码:

git clone https://github.com/ethereum/go-ethereum

2)安装go环境

brew install go

3)compile、build、install geth

cd go-ethereum

make geth

4)xcode支持

If you see some errors related to header files of Mac OS system library, install XCode Command Line Tools, and try again.

xcode-select --install

5)测试安装是否成功

执行命令:geth version,如果出现以下信息说明安装成功

> geth version

Geth

Version: 1.8.14-stable

Architecture: amd64

Protocol Versions: [63 62]

Network Id: 1

Go Version: go1.10.3

Operating System: darwin

GOPATH=/Users/wuzhengfei/Documents/workspace/go/workspace

GOROOT=/usr/local/go

二搭建私有链

在go-ethereum中详细介绍了搭建私有链的过程,有兴趣的话,可以详细看一下。

1常见创世区块

1)常见创世区块

首先需要为区块链创建一个创世区块,所有的区块都会挂在这个创世区块的后面。创建一个json文件(这里命名为genesis.json),其内容如下:

{

"config": {

"chainId": 0,

"homesteadBlock": 0,

"eip155Block": 0,

"eip158Block": 0

},

"alloc": {},

"coinbase": "0x0000000000000000000000000000000000000000",

"difficulty": "0x20000",

"extraData": "",

"gasLimit": "0x2fefd8",

"nonce": "0x0000000000055555",

"mixhash": "0x00000000000000000000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值