EVM RPC Canister

The latest update to the EVM RPC Canister (v2.7.0) and the accompanying evm-rpc-client library (v0.2.0) is focused on significantly improving the experience of calculating Cycles cost for Ethereum RPC calls.

Here is a breakdown of the key changes:

1. New Cycles Cost Endpoints on the Canister

The core feature is the introduction of dedicated *_CyclesCost query endpoints for all existing eth_* RPC methods.

  • What’s new: For every update method (like eth_getLogs), there is now a corresponding query method (like eth_getLogsCyclesCost).

  • The User-Friendliness Improvement:

    • Old Method (requestCost): To estimate the cost of an RPC call, developers had to manually construct the raw, complex JSON-RPC payload for the specific eth_* method and pass it to the general requestCost endpoint. This was error-prone and required deep knowledge of the underlying RPC structure. (The requestCost endpoint is now deprecated).

    • New Method (*_CyclesCost): The new endpoints use the exact same simple function signature as the actual update methods they are estimating the cost for. This means you can use the same native Rust/Motoko types you use for the actual call to get the cost, making the process intuitive and boilerplate-free.

  • Multi-Provider Support: The new design also allows calculating the estimated Cycles cost for requests that utilize multiple RPC providers (such as the default provider set), which the deprecated method could not handle.


2. Corresponding Update to the Client Library

The client library has been updated to fully leverage this new, user-friendly canister interface:

  • evm_rpc_client-v0.2.0 introduces a new, high-level method: client.request_cost().

  • This method is designed to be the go-to way for cost estimation, hiding the complexity of the underlying canister call and directly using the new *_CyclesCost endpoints.

  • By updating the client library, developers can immediately switch to the simple, type-safe way of determining the Cycles required to execute their EVM RPC requests, making integration seamless and robust.


Links: