美文网首页以太坊区块链世界已经开启
以太坊源码导读 大致分两部分

以太坊源码导读 大致分两部分

作者: 于桓 | 来源:发表于2017-07-02 08:45 被阅读695次

最近看好几天以太坊的源码没看出个所以然。一般研究一个项目代码一般是把项目先跑起来。看了半天没找到代码入口。

https://github.com/ethereum/pyethereum
这个是目前的分支,可以看到已经非常复杂了。

由github的commit记录我们可以大致确定以太坊的主要代码。即链接:https://github.com/ethereum/pyethereum/tree/e476fb19bc0d55fb120772c175e438e21a0cefb1
blocks.py
parser.py
processblock.py
rlp.py
transactions.py
trie.py
trietest.py
这几部分组成。

从这个地方我们看到大体的运行流程
https://github.com/ethereum/pyethereum/tree/e658ce7386edb20c04910cb3bca6389399bcaaeb

test_rlp.py
test_trie.py
是以太坊的主要组成的两部分。

rlp应该是一种编码方法
trie应该是一种树形结构

processblock组织起了transactions和block
blocks.py
transactions.py

如何读懂以太坊需要先弄明白两部分,即rlp,trie与blocks,transactions。

runtest是一部分
https://github.com/ethereum/pyethereum/blob/e658ce7386edb20c04910cb3bca6389399bcaaeb/runtest.py

密码学、P2P网络通信、共识算法

插播
Andreas Antonopoulos的《完全掌握比特币》(Mastering Bitcoin)

Consensys的《用刚刚够的比特币来搞懂以太坊》(Just Enough Bitcoin for Ethereum)

相关文章

网友评论

    本文标题:以太坊源码导读 大致分两部分

    本文链接:https://www.haomeiwen.com/subject/rfrncxtx.html