当前位置:网站首页>Transactions proof in appliedzkp zkevm (10)
Transactions proof in appliedzkp zkevm (10)
2022-06-28 10:22:00 【mutourend】
1. introduction
transactions proof Meeting :
- Verify the signature of each transaction ;
- verification
transactionsRootCorresponding merkle patricia trie It just contains all the transactions ( No less ); - bring EVM proof It can be done by transaction table visit transactions data.
2. Transcation encoding
There are different transaction coding methods . In the first version zkEVM Only compatible will be supported EIP-155 Of Legacy transaction. The future will support Non-Legacy (EIP-2718)transactions.
2.1 Legacy Transaction encoding
Legacy type by :
rlp([nonce, gasPrice, gas, to, value, data, sig_v, r, s])
- stay BIP-155 Before , To be signed hashed data by :
(nonce, gasprice, gas, to, value, data)withsig_v = {0,1} + 27 - stay EIP-155 after , To be signed hashed data by :
(nonce, gasprice, gas, to, value, data, chain_id, 0, 0)withsig_v = {0,1} + CHAIN_ID * 2 + 35
Among them {0,1} It means curve point y y y Polarity of coordinates , The curve point Corresponding to secp256k1 The public key in the signing process .
2.2 Non-Legacy (EIP-2719) Transaction encoding
according to :
Non-Legacy The type is :
0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])
To be signed hashed data by : undetermined .
3. Circuit behaviour
Transactions proof Prove the corresponding in the circuit public inputs Yes :
- chain_id
- transactionsRoot
Each transaction is defined by the following parameters :
- (nonce, gas_price, gas, to, value, data, sig_v, sig_r, sig_s)
Which can be used as public inputs The parameters are :
- (nonce, gas_price, gas, to, value, data, from)
Transactions proof The verification logic of the proof circuit is :
- 1)txSignData: bytes = rlp([nonce, gas_price, gas, to, value, data, chain_id, 0, 0])
- 2)txSignHash: word = keccak(txSignData)
- 3)sig_parity: {0, 1} = sig_v - 35 - chain_id / 2
- 4)ecdsa_recover(txSignHash, sig_parity, sig_r, sig_s) = pubKey Or equivalent to verify(txSignHash, sig_r, sig_s, pubKey) = true
- 5)fromAddress = keccak(pubKey)[-20:]
among :
- The first 1) For transaction parameters in step rlp The coding will be customized rlp encoding gadget To achieve , To distinguish ( differ )MPT circuit Used in rlp encoding.
- The first 2) The message to be signed in step keccak hash Validation will be done using keccak circuit. The tx circuit A separate correspondence will be implemented keccak Of lookup table( Use RLC take rlp encoded transaction Class to step up a single value Inside ).
- The first 3) In the step, the public key will be recovered according to the message to be signed and the signature ECDSA circuit. The tx circuit Will implement a corresponding ECDSA Of lookup table.
- The first 5) The public key in step keccak hash Validation will be done using keccak circuit. The tx circuit Will implement a corresponding keccak Of lookup table.
According to the above information , To build the TxTable:
| 0 TxID | 1 Tag | 2 Index | 3 value |
|---|---|---|---|
| TxContextFieldTag | |||
| $TxID | Nonce | 0 | $value: raw |
| $TxID | Gas | 0 | $value: raw |
| $TxID | GasPrice | 0 | $value: rlc |
| $TxID | GasTipCap | 0 | $value: 0 |
| $TxID | GasFeeCap | 0 | $value: 0 |
| $TxID | CallerAddress | 0 | $value: raw |
| $TxID | CalleeAddress | 0 | $value: raw |
| $TxID | IsCreate | 0 | $value: raw |
| $TxID | Value | 0 | $value: rlc |
| $TxID | CallDataLength | 0 | $value: raw |
| $TxID | CallData | $ByteIndex | $value: raw |
among :
- Gas = gas
- GasTipCap = 0
- GasFeeCap = 0
- CallerAddress = fromAddress
- CalleeAddress = to
- IsCreate =
1 if to is None else 0 - CallDataLength = len(data)
- CallData[KaTeX parse error: Can't use function '\]' in math mode at position 10: ByteIndex\̲]̲ = data\[ByteIndex]
Reference material
边栏推荐
- Resolution: overview of decentralized hosting solution
- R language plot visualization: plot to visualize overlapping histograms, and use geom at the bottom edge of the histogram_ The rugfunction adds marginal rugplots
- ruoyi集成积木报表(nice)
- linux中源码安装mysql数据库(centos)
- 如何使用 DataAnt 监控 Apache APISIX
- 为什么 Istio 要使用 SPIRE 做身份认证?
- PyGame game: "Changsha version" millionaire started, dare you ask? (multiple game source codes attached)
- 请教下, 我在本地idea运行flinkcdc的mysql到mysql全量同步,这个是在我本地ide
- [unity][ecs] learning notes (III)
- Bridge mode
猜你喜欢
![[Unity][ECS]学习笔记(一)](/img/eb/1f0ad817bbc441fd8c14d046b82dd0.png)
[Unity][ECS]学习笔记(一)

【NLP】今年高考英语AI得分134,复旦武大校友这项研究有点意思

Day 6 script and animation system

建立自己的网站(11)
![[unity] built in rendering pipeline to URP](/img/a5/3ae37b847042ffb34e436720f61d17.png)
[unity] built in rendering pipeline to URP
![[Unity]EBUSY: resource busy or locked](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[Unity]EBUSY: resource busy or locked

dotnet 使用 Crossgen2 对 DLL 进行 ReadyToRun 提升启动性能

Adapter mode

bye! IE browser, this route edge continues to go on for IE

Understand 12 convolution methods (including 1x1 convolution, transpose convolution and deep separable convolution)
随机推荐
Proxy mode (proxy)
2D code generator for openharmony application development
谁知道在中信建投证券开户是不是安全的
Please consult me. I run the MYSQL to MySQL full synchronization of flykcdc in my local ide. This is in my local ide
Sqlcmd database connection error
Huawei OSPF single region
【NLP】今年高考英语AI得分134,复旦武大校友这项研究有点意思
R语言plotly可视化:plotly可视化互相重叠的直方图(histogram)、在直方图的底部边缘使用geom_rug函数添加边缘轴须图Marginal rug plots
建立自己的网站(11)
Ideal interface automation project
无线通信模块定点传输-点对多点的具体传输应用
Google开源依赖注入框架-Guice指南
我大抵是卷上瘾了,横竖睡不着!竟让一个Bug,搞我两次!
Fabric.js 笔刷到底怎么用?
纵观jBPM从jBPM3到jBPM5以及Activiti
【力扣——动态规划】整理题目1:基础题目:509、70、746、62、63、343、96(附链接、题目描述、解题方法及代码)
[happy Lantern Festival] guessing lantern riddles eating lantern festival full of vitality ~ (with lantern riddle guessing games)
增强 Jupyter Notebook 的功能,这里有四个妙招
爬虫小操作
Crawler small operation