diff --git a/website/src/pages/en/subgraphs/developing/creating/graph-ts/api.mdx b/website/src/pages/en/subgraphs/developing/creating/graph-ts/api.mdx index 3cfb1b9fcc27..447c13b33bb3 100644 --- a/website/src/pages/en/subgraphs/developing/creating/graph-ts/api.mdx +++ b/website/src/pages/en/subgraphs/developing/creating/graph-ts/api.mdx @@ -372,6 +372,30 @@ store.remove('Transfer', id) The Ethereum API provides access to smart contracts, public state variables, contract functions, events, transactions, blocks and the encoding/decoding Ethereum data. +#### Ethereum JSON‑RPC Schema Changes & Execution Client Compatibility + +Following Ethereum's [transition to Proof of Stake](https://ethereum.org/en/roadmap/merge/), the Execution Layer JSON-RPC schema was updated to reflect changes in block metadata. + +The `totalDifficulty` field was [officially removed](https://github.com/ethereum/execution-apis/pull/570) from the `eth_getBlockByNumber` response. Additionally, the `difficulty` field—previously used in Proof of Work—was retained as **optional** but is now considered obsolete and typically returned as `"0x0"` by spec-compliant clients. While some clients continue to include these fields for backward compatibility, developers relying on them should update their subgraphs and tooling to accommodate these schema changes. Full schema details are available in the [Ethereum Execution APIs documentation](https://ethereum.github.io/execution-apis/). We've added a chart with the current client compatibility with these updates as of July 17, 2025. **Please check for specific client updates as needed**. + +**Ethereum JSON‑RPC Schema Changes Post-Merge** + +| Field | JSON‑RPC Schema Status (Post-Merge) | +| ----------------- | --------------------------------------------------------------------------- | +| `totalDifficulty` | ❌ Removed from `eth_getBlockByNumber` response | +| `difficulty` | ⚠️ Optional, expected to be `0x0` post-Merge, but many clients still return | +| `size` | ⚠️ Optional; may be omitted depending on client | + +**Execution Client Compatibility** + +| Client | totalDifficulty | difficulty | size | Notes | +| --- | --- | --- | --- | --- | +| **Erigon v3** | Not returned | Non-zero | Usually present | Strict spec compliance, noted [here](https://github.com/erigontech/erigon/issues/13012) | +| **Geth** | Returned | Non-zero | Returned | Maintains legacy behavior, noted [here](https://ethereum.org/developers/docs/apis/json-rpc/#eth_getblockbyhash) | +| **Nethermind** | Returned | Non-zero | Returned | Maintains legacy behavior, noted [here](https://docs.nethermind.io/interacting/json-rpc-ns/eth/#eth_getblockbynumber) | +| **Besu** | Returns `0` for an uncle block | Non-zero | Returned | Returns deprecated fields with valid values, noted [here](https://besu.hyperledger.org/public-networks/reference/api/objects) | +| **Reth** | Not Returned | `"0x0"` | Returned | Highly spec-compliant, aligns with post-Merge schema | + #### Support for Ethereum Types As with entities, `graph codegen` generates classes for all smart contracts and events used in a Subgraph. For this, the contract ABIs need to be part of the data source in the Subgraph manifest. Typically, the ABI files are stored in an `abis/` folder.