-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
329 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: blog deploy pipline | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: [ main ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{github.repository}} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{github.workflow}} - ${{github.ref}} | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- name: setup hugo | ||
uses: peaceiris/actions-hugo@v2 | ||
with: | ||
hugo-version: '0.92.0' | ||
extended: true | ||
- name: build | ||
run: hugo --minify | ||
|
||
- name: deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{github.ref == 'refs/heads/main'}} | ||
with: | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
publish_dir: ./public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: "区块链学习--Eth" | ||
date: 2022-12-11T10:45:48+08:00 | ||
draft: true | ||
--- | ||
|
||
## 账户模型 | ||
|
||
BTC系统是***基于交易**的账本,系统中并未显示记录账户有多少钱,只能通过UTXO进行推算。 | ||
|
||
以太坊系统则采用了**基于账户的模型**,与现实中银行账户相似。系统中显示记录每个账户以太币的数量,转账是否合法只需要查看转账者账户中以太币是否足够即可,同时也不需要每次全部转账。同时,这也也天然地防范了双花攻击。当然,以太坊发这种模式也存在缺点,这种模式存在重放攻击的缺陷。A向B转账,过一段时间,B将A的交易重新发布,从而导致A账户被扣钱两次。 | ||
|
||
为了防范重放攻击,给账户交易添加计数器记录该账户交易过多少次,转账时候将转账次数计入交易的内容中。 系统中全节点维护账户余额和该计数器的交易数,从而防止本地篡改余额或进行重放攻击。 | ||
|
||
以太坊系统中存在两类账户:外部账户和合约账户。 | ||
|
||
1. 外部账户:类似于BTC系统中公私钥对。存在账户余额balance和计数器nonce | ||
2. 合约账户:并非通过公私钥对控制。(不能主动发起交易,只能接收到外部账户调用后才能发起交易或调用其他合约账户)其除了balance和nonce之外还有code(代码)、storage(相关状态-存储)创建合约时候会返回一个地址,就可以对其调用。调用过程中,代码不变但状态会发生改变。 | ||
|
||
为什么要做以太坊,更换为基于账户的模型而不是沿袭BTC系统? 比特币中支持每次更换账户,但以太坊是为了支持 | ||
智能合约,而合约签订双方是需要明确且较少变化的。尤其是对于合约账户来说,需要保持稳定状态。 | ||
|
||
## 数据结构 |
Oops, something went wrong.