Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move crypto to zkdapp-learning #1001

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions basic/34-scroll-layer2/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ module.exports = {
mnemonic()
]
},
polygonZkEVM: {
url: `https://rpc.public.zkevm-test.net`,
accounts: [ mnemonic()
],
},
},
etherscan: {
apiKey: {
Expand Down
27 changes: 27 additions & 0 deletions basic/45-Ethereum-2.0/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

# 源码解析:
以太坊中的MPT
以太坊中的所有的merkle树都是指Merkle Patricia Tree。

从区块头中可以看到有3棵MPT的根。

stateRoot
transcationsRoot
receiptsRoot

## State树
State树是一棵全局的树,它的key是sha3(ethereumAddress),即账户地址的hash值。其存储的值value为rlp(ethereumAccount),即账户信息的rlp编码。其中账户信息是一个[nonce,balance,storageRoot,codeHash]的四元组,其中storageRoot指向账户的Storage树。

## Storage树
一般的外部账户Storage为空,而合约账户通常会储存一定的数据,这些数据就是存储在合约账户的Storage树中,storage树中的key与账户地址和其中实际存储的key有关,其value值为合约定义的value值。

## Transactions树
每一个区块都会有一棵Transactions树,其key为rlp(transactionIndex)(交易在区块中的编号,0,1…),其value值为经过rlp编码的交易。在实际情况中该树并不会真的存储到数据库中,只是在生成block以及校验block的时候用于得到当前区块的TransactionsRoot。

## Receipts树
每一个区块都会有一棵Receipts树树,其key为rlp(transactionIndex)(交易在区块中的编号,0,1…),其value值为经过rlp编码的交易收据。在实际情况中该树并不会真的存储到数据库中,只是在生成block以及校验block的时候用于得到当前区块的ReceiptsRoot。



## 参考链接:
以太坊技术与实现:https://learnblockchain.cn/books/geth/part3/statedb.html
18 changes: 14 additions & 4 deletions basic/49-aa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ yarn
yarn hardhat run scripts/paymaster.js
```

## 文档
- eip-4337文档:4337的规范。https://eips.ethereum.org/EIPS/eip-4337
- sdk:提供了构建UserOperation,推送UserOperation的能力。源码位于https://github.com/eth-infinitism/bundler/tree/main/packages/sdk。
npm包位于
https://www.npmjs.com/package/@account-abstraction/sdk。

- bundler:收集UserOperation,验证并推送到EntryPoint合约。git地址https://github.com/eth-infinitism/bundler
- contracts: 主要是EntryPoint,验证UserOperation,并调用AA账户的业务逻辑。git地址https://github.com/eth-infinitism/account-abstraction

# 参考资料

[EIP-4337](https://eips.ethereum.org/EIPS/eip-4337)
[EIP-4337 Implementation](https://github.com/eth-infinitism/account-abstraction)
[Resources](https://eip4337.com/en/latest/resources.html)
[开发指导](https://www.notion.so/dapplearning/1-9d99463f25ca4c32a5776f6f2cb57edf)
- [EIP-4337](https://eips.ethereum.org/EIPS/eip-4337)
- [EIP-4337 Implementation](https://github.com/eth-infinitism/account-abstraction)
- [Resources](https://eip4337.com/en/latest/resources.html)
- [开发指导1](https://www.notion.so/dapplearning/1-9d99463f25ca4c32a5776f6f2cb57edf)
- [用trampoline开发AA钱包](https://docs.qq.com/doc/DVHBBU0lxR0V4dEV4)

Loading
Loading