Skip to content

Commit

Permalink
feat: add new
Browse files Browse the repository at this point in the history
  • Loading branch information
phenix3443 committed Sep 18, 2023
1 parent e9b9c44 commit eb6575f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
6 changes: 4 additions & 2 deletions content/posts/geth-code/ch00-00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ tags:
- geth
---

本文介绍以太坊的基本概念
本文介绍以太坊的基本概念以及几种实现
<!-- more -->
## 概述

Expand All @@ -39,7 +39,9 @@ Ethereum 上每个账户的以太币余额以及每个智能合约存储的数

## Merge

## Geth
## 客户端实现

### Geth

[Geth](https://geth.ethereum.org) 是以太坊协议的官方 Golang 执行层实现。

Expand Down
14 changes: 13 additions & 1 deletion content/posts/geth-code/ch01-00-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ images: []

## 概述

以太坊节点由两个客户端组成:一个执行客户端和一个共识客户端。Geth 就是一个执行客户端。自从以太坊关闭了工作量证明并实施了权益证明后,Geth 就需要与另一款名为“共识客户端”的软件配对,以便跟踪以太坊区块链。

执行客户端(Geth)负责处理交易、交易广播、状态管理以及支持以太坊虚拟机 EVM。然而,Geth 并不负责构建区块、区块广播或处理共识逻辑。这些都是共识客户端的职责范围。

以下示意图展示了两个以太坊客户端之间的关系。这两个客户端各自连接到自己的对等网络(P2P)。这是因为执行客户端通过其 P2P 网络传播交易,使他们能够管理自己的本地交易池。共识客户端通过其 P2P 网络传播区块,从而实现共识和链的增长。

![node-architecture](https://geth.ethereum.org/images/docs/node-architecture-text-background.png)

为了使这种双客户端结构能够运行,共识客户端必须能够将交易包传递给 Geth 以执行。本地执行交易是客户端验证交易不违反任何以太坊规则,并且提出的以太坊状态更新是正确的方式。同样,当节点被选为区块生产者时,共识客户端必须能够从 Geth 请求交易包以包含在新的区块中。这种客户端间的通信是通过使用引擎 API 的本地 RPC 连接来处理的。

## 安装

官方有介绍 [多种方法安装 geth](https://geth.ethereum.org/docs/getting-started/installing-geth) ,由于我们是目的阅读源码,所以选择本地编译 Geth,以便后续的调试和代码走读。
Expand All @@ -43,7 +53,7 @@ Clef 的`newaccount`子命令生成新账户,`--keystore`参数用于指示存
mkdir -p data/keystore && clef newaccount --keystore data/keystore
```

然后根据提示操作即可生成账号。
然后根据提示操作即可生成账号。[更多账号管理方面的知识](https://geth.ethereum.org/docs/fundamentals/account-management)

## 启动 Clef

Expand All @@ -67,6 +77,8 @@ Clef 使用保存在密钥库中的私钥来签署交易,因此,需要与 Ge

执行上述命令将启动 Geth。仍需要有一个共识客户端,否则 Geth 将无法正确同步区块链。

更多 [命令行参数](https://geth.ethereum.org/docs/fundamentals/command-line-options)

## 启动共识客户端

有五种共识客户端可供选择,所有这些客户端都以相同的方式连接到 Geth。
Expand Down
23 changes: 23 additions & 0 deletions content/posts/geth-code/ch60-06-engine-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Geth Engine Api
description: 执行层与共识层交互
slug: ch60-06-engine-api
date: 2023-09-18T10:58:48+08:00
featured: false
draft: true
comment: true
toc: true
reward: true
pinned: false
carousel: false
math: false
series:
- 以太坊设计与实现
categories: [ethereum]
tags: [geth]
images: []
---

本文介绍执行层与共识层的交互。

<!--more-->

0 comments on commit eb6575f

Please sign in to comment.