Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EVM RPC docs for new pricing model #3499

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions docs/developer-docs/multi-chain/ethereum/evm-rpc/costs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,23 @@ The following formula shows how to calculate the cycles cost for an RPC request:

```
(
3M
+ 60K * nodes_in_subnet // Number of nodes in the subnet
+ 400 * request_size // Size of the HTTP request in bytes
+ 800 * max_response // Maximum HTTP response size in bytes
+ provider_cost // Fixed cost for selected RPC provider
) * nodes_in_subnet // Fixed canister overhead cost per node in subnet
5_912_000
+ 60_000 * nodes_in_subnet // Number of nodes in the subnet
+ 2400 * request_size // Size of the HTTP request in bytes
+ 800 * max_response_size // Maximum HTTP response size in bytes
) * nodes_in_subnet
* rpc_services // Number of RPC services used to check consistency
```

Here is an approximate cost breakdown in USD for an RPC request on the Ethereum mainnet using Cloudflare Web3 and assuming a 13-node subnet:
The total cost for an RPC request (assuming a 1kB request, 1kB response, 34-node subnet, and 1 [XDR](https://internetcomputer.org/docs/current/developer-docs/gas-cost#units-and-fiat-value) = $1.336610 USD)
is ~ $0.00051 USD.

- Total cost: ~ $0.0021 (assuming consensus between 3 RPC providers)
Note that the cost is multiplied by the number of RPC services used for the consistency logic. If you specify three different services, it will cost three times as much as a call to a single RPC provider.

- Cost per RPC provider: ~ $0.000686 (assuming 1kB request and 1kB response)
In addition, it's necessary to send `10_000_000 * nodes_in_subnet * rpc_services` additional cycles, which will be refunded, as they serve as a buffer for any future increases in third-party JSON-RPC API costs.

- Canister overhead: ~ $0.0000364

- HTTPS outcall overhead: ~ $0.00025

- JSON Request: ~ $0.0002 / kB

- JSON Response: ~ $0.0002 / kB

Note that the cost is multiplied by the number of RPC services used for the agreement / consensus logic. If you specify three different services, it will cost three times as much as a call to a single RPC provider.

The EVM RPC canister automatically refunds any cycles sent beyond the cost of the RPC request.
The EVM RPC canister automatically refunds any cycles sent beyond the cost of the RPC request, so it's possible to send more cycles than necessary without consequence.
Sending extra cycles will also provide a budget to retry the request with a larger maximum response size for Candid-RPC methods such as `eth_getLogs` and `eth_getBlockByNumber`.

## Collateral cycles

Expand Down
Loading