We proposed a new system contract to Scroll called L1Blocks . The contract is used to hold the data from L1 block header. This allows developers to have access to L1 block information such as block hash, state root, randao, etc.
| Parameter | Value |
|---|---|
BLOCK_BUFFER_SIZE |
8192 |
| Contract address | 0x5300000000000000000000000000000000000001 |
The L1Blocks contract currently stores eight fields from the L1 block headers for the most recent BLOCK_BUFFER_SIZE blocks. The protocol and contract guarantees the continuity of the imported L1 blocks. The header fields that are stored in the contract include
The contract provides several methods to get the header field from the latest imported block and get the field given a specific block number. If the block number is out of the range of the blocks in the contract, the contract will revert with an error. The full contract interface can be found at ‣
The L1 block headers are trustlessly imported via a sequencer-generated system transaction (a new transaction type introduced on Scroll). The transaction provides the full RLP-encoded L1 block header and then decoded in the contract. In essence, the contract verifies the header chain and stores the fields of the most recent blocks. The blockhash of the last imported L1 block in a batch is then exposed to the public input to cross check with the blockhash read in the L1 contract when the batch data is posted to L1.
There is a delay in the import of the L1 blocks to reduce the chance of L1 re-orgs. In the current devnet, the delay is 5 block confirmations (1 min) on L1. But the delay is subjected to change in the final production environment.
Contracts