您的位置:首页 > 编程语言 > Go语言

go-ethereum 源码阅读环境搭建

2018-06-07 14:35 639 查看

1. 安装go运行环境

https://dl.google.com/go/go1.10.2.windows-amd64.msi  

2. 安装git工具

3. 安装gcc(go编译geth需要使用)

https://jaist.dl.sourceforge.net/project/tdm-gcc/TDM-GCC%20Installer/tdm-gcc-5.1.0-3.exe

4. 安装go集成开发环境,这里介绍两种方法

4.1 安装go集成开发环境goeclipse,即在eclipse中添加go插件。

环境要求:

  • Java VM version 8 or later.
  • Eclipse 4.6 (Neon) or later.
  • CDT 9.0 or later (this will be installed or updated automatically as part of the steps below).


打开eclipse > help > Install New Software… 

在work with中输入:goeclipse - http://goclipse.github.io/releases,点击Add


4.2 安装GoLand,不过该软件是收费软件,但可以免费使用30天

https://dl.google.com/go/go1.10.2.windows-amd64.msi


5.下载并编译go-ethereum

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

运行完后会在C:\Users\Administrator\go\src\github.com目录下生成

6. 在eclipse或goland中导入go-ethereum代码


7. go-ethereum代码机构

accounts        	实现了一个高等级的以太坊账户管理
bmt			二进制的默克尔树的实现
build			主要是编译和构建的一些脚本和配置
cmd			命令行工具,又分了很多的命令行工具,下面一个一个介绍
/abigen		Source code generator to convert Ethereum contract definitions into easy to use, compile-time type-safe Go packages
/bootnode	启动一个仅仅实现网络发现的节点
/evm		以太坊虚拟机的开发工具, 用来提供一个可配置的,受隔离的代码调试环境
/faucet
/geth		以太坊命令行客户端,最重要的一个工具
/p2psim		提供了一个工具来模拟http的API
/puppeth	创建一个新的以太坊网络的向导
/rlpdump 	提供了一个RLP数据的格式化输出
/swarm		swarm网络的接入点
/util		提供了一些公共的工具
/wnode		这是一个简单的Whisper节点。 它可以用作独立的引导节点。此外,可以用于不同的测试和诊断目的。
common			提供了一些公共的工具类
compression		Package rle implements the run-length encoding used for Ethereum data.
consensus		提供了以太坊的一些共识算法,比如ethhash, clique(proof-of-authority)
console			console类
contracts
core			以太坊的核心数据结构和算法(虚拟机,状态,区块链,布隆过滤器)
crypto			加密和hash算法,
eth			实现了以太坊的协议
ethclient		提供了以太坊的RPC客户端
ethdb			eth的数据库(包括实际使用的leveldb和供测试使用的内存数据库)
ethstats		提供网络状态的报告
event			处理实时的事件
les			实现了以太坊的轻量级协议子集
light			实现为以太坊轻量级客户端提供按需检索的功能
log			提供对人机都友好的日志信息
metrics			提供磁盘计数器
miner			提供以太坊的区块创建和挖矿
mobile			移动端使用的一些warpper
node			以太坊的多种类型的节点
p2p			以太坊p2p网络协议
rlp			以太坊序列化处理
rpc			远程方法调用
swarm			swarm网络处理
tests			测试
trie			以太坊重要的数据结构Package trie implements Merkle Patricia Tries.
whisper			提供了whisper节点的协议。

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: