区块链中文技术社区

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

跨链交易发起:0x0bbbcf153f17ec0e1f12d698bbc64f9d242bc1cd1312dd5f34febf0e6cb6601a

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

select * from miniblocks where number=15841;

3. 得到当前跨链交易所在`l1_batch_number`为7670
4. 根据`l1_batch_number`,以`number`查看`l1_batches`表

select number,is_finished,eth_commit_tx_id,eth_prove_tx_id,eth_execute_tx_id from l1_batches where number=7670;

得到
numberis_finishedeth_commit_tx_ideth_prove_tx_ideth_execute_tx_id
7670t410734114841151
5. 根据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
6. 根据`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
7. 同理查询`eth_prove_tx_id`和`eth_execute_tx_id`得到对应的交易hash

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »