[Application Development] How to find the closest L1 block number from L2 block number? #443
-
Did you check the documentation?
Did you check for duplicate questions?
Issue DescriptionIf I know the block number of an OP-stack L2, can I calculate the latest L1 block number at the time this block was generated? I can look up the block closest in time using the timestamp, but I want to know if there's an easier method (e.g., using epoch number or something similar). Additional Informationin our application use case, we need to query some oracle contract deployed on L1 when receiving a L2 block. That's why we want to know the L1 block. we can use "latest" block tag when querying the RPC but there is another use case where we want to query such data from an old L2 block. that's why I have this questions FeedbackNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
CC @sbvegan |
Beta Was this translation helpful? Give feedback.
CC @sbvegan
I would like to share a preliminary observation. By examining the input data of this L2 transaction: https://sepolia-optimism.etherscan.io/tx/0x92176aca750cf02d0e23db9bb66fa941d702470d5d1d3240434b3f6f579d7685, it appears to contain information about the L1 block. The timestamps of these two blocks are very close, and I believe that every L2 block includes such a transaction