Introduction
As a decentralized digital currency system, the network architecture of Ethereum is very important since the synchronization of data and the update of nodes’ status both depend on the connection mechanism between nodes. Peer to Peer(P2P) protocol is used as a communication link for Ethereum and has been developed in various aspects according to the transmission of data(e.g. blocks, transaction and hash value) and message in the network, which can be divided into three layers.
以太坊作为一种去中心化货币系统,其底层的网络架构是非常重要的,所有数据的同步,节点状态的更新都取决于节点间运行的通信机制。以太坊采用P2P协议作为其通讯链接,并对协议进行独特的设计开发,其可以分为三层。
Three-tier architecture
The P2P function in Ethereum was design as a package to support multiple protocols on it that allows programers to rapidly and easily add peer to peer networking to any type of application since it is regarded as a communication link for the transmisstion of the upper layer protocol shown in figure below:
The uppermost layer is the specific implementation of each protocol in Ethereum, such as ETH protocol and LES protocol.
The second layer is the p2p communication link layer in Ethereum. It is mainly responsible for starting monitoring, processing new inbound/outbound connections or maintaining built links, providing channels for upper layer protocols and calling methodes of the bottom layer to analyse messages.
The bottom layer is the network IO layer provided by the Go language, which is the encapsulation of the network layer in
TCP/IP
.Specifically, the p2p communication link layer mainly does three things:
After the data of the upper layer protocol is delivered to the p2p layer, it is first encoded by RLP.
The RLP encoded data will be encrypted by the shared key to ensure the security of the data during the communication process.
Finally, the data stream is converted to an RLPXFrameRW frame for easy encrypted transmission and parsing of data.
以太坊中的P2P功能被设计为能支持在其上运行的多种协议的程序包,允许程序员快速且容易地将对等网络添加到任何类型的应用中。如上图1所示。
- 最上层是由以太坊里具体的协议组成。
- 中间的P2P通讯链接层主要是用于启动节点监控,处理连入/连出或者维持现有链接,向上层协议提供访问通道以及调用下层函数来分析消息包。
- 最下层则是对Go语言中
TCP/IP
协议的底层封装。
具体而言,P2P通讯链接层主要执行以下三种动作:
- 对上层传递下来的消息进行
RLP
编码。 - 接着对
RLP
编码后的数据用共享加密的方式确保数据传输过程中的安全性。 - 最后,该数据流转换为
RLPXFrameRW
帧进行简单加密并传输。
Conclusion
We take a glance look at this short blog, we can have a simple understanding of the three-tier architecture of Ethereum P2P network. However, it does not provide anything specific analysis about the Ethereum’ source code. If you are interest about it, you can read more further in [2].
本短文主要是对以太坊P2P网络的三层架构模型提供一个简单的概览。并且没有涉及到以太坊源码的具体分析,如果对源码有兴趣的,可以进一步阅读参考文献[2]。
Reference
[1]Ethereum Network Architecture Analysis
The End
广州市云计算安全与测评技术重点实验室
华南师大-唯链区块链技术与应用联合实验室
粤港澳大湾区区块链应用推广中心
广东省计算机学会区块链专委会
相关内容分享只作为学术讨论,仅供访问者使用参考。我们尊重相关版权人的权利,但受限于篇幅、技术等客观因素,不保证所有信息、文本、图形、链接及其它项目的绝对准确性、绝对完整性和完整备注他人权利。我们尽最大的努力保证内容的科学性和严谨性等,但我们对使用上述内容而产生的相关后果不承担任何商业和法律责任