欢迎所有爱好区块链技术的人加入。

ARCHIVES / 1853.HTML

zkSync 根据l2到l1跨链hash查询CommitBlocks,PublishProofBlocksOnchain,ExecuteBlocks各个L1层交易hash

Surou zkSync

跨链交易发起:0x0bbbcf153f17ec0e1f12d698bbc64f9d242bc1cd1312dd5f34febf0e6cb6601a

  1. 根据tx_hash查看表l2_to_l1_logs,得到所在的miniblock_number为15841
  2. 根据上面的miniblock_number,根据number查看表miniblocks

select * from miniblocks where number=15841;

3. 得到当前跨链交易所在`l1_batch_number`为7670
4. 根据`l1_batch_number`,以`number`查看`l1_batches`表
	```sql
select number,is_finished,eth_commit_tx_id,eth_prove_tx_id,eth_execute_tx_id from l1_batches where number=7670;

得到

 number | is_finished | eth_commit_tx_id | eth_prove_tx_id | eth_execute_tx_id 
--------+-------------+------------------+-----------------+-------------------
   7670 | t           |            41073 |           41148 |             41151
  1. 根据eth_commit_tx_id查询eth_txs,得到CommitBlocks对应交易信息
select nonce,contract_address,tx_type,has_failed,sent_at_block,tx_status,confirmed_eth_tx_history_id from eth_txs where id=41073 ORDER BY updated_at DESC limit 1;
 nonce |              contract_address              |   tx_type    | has_failed | sent_at_block | tx_status | confirmed_eth_tx_history_id 
	-------+--------------------------------------------+--------------+------------+---------------+-----------+-----------------------------
	 41091 | 0x5e3e5f6ef0e21f0cf5b4c3acd3cf29740b1cbbd8 | CommitBlocks | f          |               | Done      |                       43194
  1. 根据confirmed_eth_tx_history_id 得到CommitBlocks对应交易hash
select eth_tx_id,tx_hash,confirmed_at from eth_txs_history where id=43194  ORDER BY updated_at DESC limit 10;
eth_tx_id |                              tx_hash                               |        confirmed_at        
	-----------+--------------------------------------------------------------------+----------------------------
		 41073 | 0x0b01e199877faef52b95477119f53bf546a2915bc903132331f41542e58da53d | 2023-09-18 03:50:19.059576
  1. 同理查询eth_prove_tx_id和eth_execute_tx_id得到对应的交易hash