Skip to main content

Ethereum

2022/05/25

Ethereum的学习可以有很多部分,参考官网

Ethereum Basics

值得注意的是目前还是PoW,PoS的beacon chain已经在运行了,但还没有merge到主链上,预计2022年Q3~Q4merge。

Wei Gwei

DenominationValue in etherCommon Usage
Wei10-18Technical implementations
Gwei10-9Human-readable gas fees

你递交了一次交易,这个交易会和其他交易一同发往pool,矿工们会负责将你的Transaction提交到block上。nonce证明这个block经过了PoW。

EVM

Evm是一个状态机,而且它功能很强大,可以模拟很多指令。

Merkle Patricia Trie

https://eth.wiki/en/fundamentals/patricia-tree 这个算法还没有仔细研究,日后再看吧

Gas

Let's say Jordan has to pay Taylor 1 ETH. In the transaction, the gas limit is 21,000 units and the base fee is 100 gwei. Jordan includes a tip of 10 gwei.

Using the formula above we can calculate this as 21,000 * (100 + 10) = 2,310,000 gwei or 0.00231 ETH.

When Jordan sends the money, 1.00231 ETH will be deducted from Jordan's account. Taylor will be credited 1.0000 ETH. Miner receives the tip of 0.00021 ETH. Base fee of 0.0021 ETH is burned.

Gas Limit

是指你最大愿意支出的Gas数量。值得注意的是,即便Transaction reverted,gas也不会退回。

Running node

有很多Ethereum的implementation,如V神的Geth

这里列举了很多Run your own node的好处,比如你可以在上面开发dapp, 并且你不会泄露地址,而且可以自己verify transaction等等。

还有Light node, Archive node,满足不同需求。

Node as a service

这里比较有名的如Ankr, Infura

Infura是用的非常多的,每天有10万次免费的api请求,可以在testnet上用,测试自己的dapp很棒。

Testnets

目前最新的有Sepolia 和Görli

Concensus

PoW有Dagger-hashimoto算法和Ethash。

PoS比较有意思了,有Gasper,会专门惩罚懒惰和犯错的verifier。这也可能是为啥一开始很多人质押反而损失了Eth吧。

Weak Subjectivity

https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/

主要是安全有关的特性吧,可以看下这篇文章

主要是和第一个Genesis Block有关的

Tools

几个有意思的学习工具:

CyptoZombies, 用Solidity做一个僵尸游戏

Ethernauts 闯关,挑战破解合约

Capture The Ether Hack合约

Eth.build功能很强大,而且可视化编辑,像做DML图一样,演示的时候可以用

Remix Replit 很强大的ide, Remix现在有VS Code的extension了。

Token standards

  • ERC-20 - A standard interface for fungible (interchangeable) tokens, like voting tokens, staking tokens or virtual currencies.

  • ERC-721 - A standard interface for non-fungible tokens, like a deed for artwork or a song.

  • ERC-777 - A token standard improving over ERC-20.

  • ERC-1155 - A token standard which can contain both fungible and non-fungible assets.

    在Chainlink中,还用到了ERC677 Compatible Token,这种标准是一种transferAndCall标准。link

PoA Proof of Authority

之前看文档有个PoA Testnet一直不懂什么意思,后来才知道,PoA就是Proof of Authority的意思,说白了也就是PoS的究极形态,寡头政治。大概一小撮权威人士掌握着验证区块的权利,而它们也必须保证自己的node一直运行。