当前位置:网站首页>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
边栏推荐
- Is it safe to open an account with the QR code of CICC securities? Tell me what you know
- 使用 ABAP 操作 Excel 的几种方法
- ruoyi集成积木报表(nice)
- Unity loads AssetBundle resources from the server and writes them to local memory, and loads the downloaded and saved AB resources from local memory to the scene
- 谁知道在中信建投证券开户是不是安全的
- 2022 Wu Enda machine learning specialization week 2 practice lab: linear expression
- 卸载oracle报错
- R language plot visualization: plot to visualize overlapping histograms, and use geom at the bottom edge of the histogram_ The rugfunction adds marginal rugplots
- 再见!IE浏览器,这条路由Edge替IE继续走下去
- 物联网5种无线传输协议特点大汇总
猜你喜欢
![[unity][ecs] learning notes (II)](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[unity][ecs] learning notes (II)

To enhance the function of jupyter notebook, here are four tips

sqlcmd 连接数据库报错

Global exception handlers and unified return results
![[NLP] this year's college entrance examination English AI score is 134. The research of Fudan Wuda alumni is interesting](/img/a8/51b95432a9c8f25d8440cfd80926ce.png)
[NLP] this year's college entrance examination English AI score is 134. The research of Fudan Wuda alumni is interesting

Why does istio use spirit for identity authentication?

Proxy mode (proxy)

Redis sentinel cluster main database failure data recovery ideas # yyds dry goods inventory #
![[Unity][ECS]学习笔记(一)](/img/eb/1f0ad817bbc441fd8c14d046b82dd0.png)
[Unity][ECS]学习笔记(一)

Starting from full power to accelerate brand renewal, Chang'an electric and electrification products sound the "assembly number"
随机推荐
Naming rules and specifications for identifiers
如何使用 DataAnt 监控 Apache APISIX
Fabric.js 笔刷到底怎么用?
Adapter mode
R语言使用car包中的avPlots函数创建变量添加图(Added-variable plots)、在图像交互中,在变量添加图中手动标识(添加)对于每一个预测变量影响较大的强影响点
Understand 12 convolution methods (including 1x1 convolution, transpose convolution and deep separable convolution)
接口自动化框架脚手架-参数化工具的实现
[unity] built in rendering pipeline to URP
How to view the web password saved by Google browser
错过金三银四,找工作4个月,面试15家,终于拿到3个offer,定级P7+
mysql数据库概述以及安装过程
Summary of MySQL basic knowledge points
生成token
Matplotlib attribute and annotation
Solve the problem that the value of the action attribute of the form is null when transferring parameters
MySQL cannot be opened. Flash back
As shown in the figure, the SQL row is used to convert the original table of Figure 1. Figure 2 wants to convert it
缓存之王Caffeine Cache,性能比Guava更强
Installing redis under Linux and windows (ultra detailed graphic tutorial)
OpenHarmony应用开发之二维码生成器