diff --git a/docs/developers/guides/finalized-block.mdx b/docs/developers/guides/finalized-block.mdx index 83ab96b63..f41ca1b06 100644 --- a/docs/developers/guides/finalized-block.mdx +++ b/docs/developers/guides/finalized-block.mdx @@ -6,24 +6,34 @@ image: /img/socialCards/retrieve-finalized-l2-blocks.jpg A finalized L2 block is a block on an L2 blockchain (Linea) that has been confirmed and validated by the L1 blockchain (Ethereum), ensuring its immutability and security. -Linea doesn't currently support the Ethereum-standard `finalized` block parameter tag, meaning you -cannot use the tag in JSON-RPC API calls to retrieve blocks that have been confirmed by the L1 -network. This includes, for example, methods where you can specify a block parameter, such as -[`linea_estimateGas`](../reference/api/linea-estimategas.mdx). +There are two methods to obtain the current finalized block: -:::note -Support for the `finalized` block parameter is planned in a future Linea release. -::: +- [Use the `finalized` block parameter tag](#use-the-finalized-tag) in JSON-RPC API calls. +- [Query the Linea L1 rollup contract](#query-the-rollup-contract). -This limitation requires you to query the [Linea L1 rollup contract](https://etherscan.io/address/0xd19d4b5d358258f05d7b411e21a1460d11b0876f#readProxyContract) -to retrieve the value of the current finalized L2 block number stored in the `currentL2BlockNumber` -variable. +## Use the `finalized` tag -## Prerequisites +Use the `finalized` tag in API calls to specify a block that has been confirmed by the L1 +network. For example, here the `eth_getBlockByNumber` method returns information about the current +finalized block: + +```bash +curl https://rpc.linea.build \ + -X POST \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["finalized",false],"id":1}' +``` + +## Query the rollup contract + +Query the [Linea L1 rollup contract](https://etherscan.io/address/0xd19d4b5d358258f05d7b411e21a1460d11b0876f#readProxyContract) +to retrieve the value of the current finalized L2 block number stored in the `currentL2BlockNumber` variable. + +### Prerequisites - [Download and install Node.js](https://nodejs.org/en) -## Create the script +### Create the script 1. In your project folder, initialize the project and install the `web3` package: diff --git a/docs/developers/reference/api/linea-estimategas.mdx b/docs/developers/reference/api/linea-estimategas.mdx index e5de7920b..0887def84 100644 --- a/docs/developers/reference/api/linea-estimategas.mdx +++ b/docs/developers/reference/api/linea-estimategas.mdx @@ -61,10 +61,13 @@ using `linea_estimateGas` for more accurate results. - `value`: _\[optional]_ Hexadecimal value of the value sent with this transaction. - `data`: _\[optional]_ Hash of the method signature and encoded parameters. See the [Ethereum contract ABI specification](https://docs.soliditylang.org/en/latest/abi-spec.html). - - `block number`: _\[optional]_ A string representing a block number, or one of the string tags `latest`, `earliest`, or - `pending`. See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block). - You can [query the L1 rollup contract](../../guides/finalized-block.mdx) to retrieve the current finalized block. + - `block number`: _\[optional]_ A string representing a block number, or one of the string tags `latest`, `earliest`, + `pending`, or `finalized`. + :::note + A `finalized` block is a block on an L2 blockchain (Linea) that has been confirmed and validated by + the L1 blockchain (Ethereum). + ::: ## Returns diff --git a/docs/developers/reference/api/linea-getproof.mdx b/docs/developers/reference/api/linea-getproof.mdx index 94a614e89..c4c0c395b 100644 --- a/docs/developers/reference/api/linea-getproof.mdx +++ b/docs/developers/reference/api/linea-getproof.mdx @@ -16,21 +16,17 @@ The supplied block parameter must be an L2 block that has been finalized on L1. In the [example response](#response) the account exists but the slot does not. -:::info important - -Linea currently does not support the block parameter `finalized`, meaning that to get the current -finalised block on the L1, users must [retrieve the value from the `currentL2BlockNumber`](../../guides/finalized-block.mdx) -variable in the [LineaRollup L1 contract](https://etherscan.io/address/0xd19d4b5d358258f05d7b411e21a1460d11b0876f#readProxyContract). - -::: - ## Parameters - `address`: A string representing the address (20 bytes) for which the proof is requested. - `storageKeys`: An array of 32-byte storage keys to be proofed and included. -- `blockParameter`: A hexadecimal block number, or one of the string tags `latest`, `earliest`, or - `pending`. See the [default block parameter](https://ethereum.org/en/developers/docs/apis/json-rpc/#default-block). - You can [query the L1 rollup contract](../../guides/finalized-block.mdx) to retrieve the current finalized block. +- `blockParameter`: A hexadecimal block number, or one of the string tags `latest`, `earliest`, + `pending`, or `finalized`. + + :::note + A `finalized` block is a block on an L2 blockchain (Linea) that has been confirmed and validated by + the L1 blockchain (Ethereum). + ::: ## Returns