How to Access Ethereum API

Step 1: To access Ethereum, use the following native access endpoints:

  • Network: Ethereum Mainnet
  • Request Type: POST
https://svc.blockdaemon.com/ethereum/mainnet/native
  • Network: Ethereum Holesky
  • Request Type: POST
https://svc.blockdaemon.com/ethereum/holesky/native
  • Network: Ethereum Sepolia
  • Request Type: POST
https://svc.blockdaemon.com/ethereum/sepolia/native

Step 2: You should authorize your request. Learn more: Authentication Guide

Step 3: Specify an Ethereum method in the request body:

{
    "jsonrpc": "2.0",
    "method": "YOUR_METHOD",
    "params": [],
    "id": 1
}

Example Request

Using Ethereum Custom Method

📘

See the list of custom methods here.

Below is an example of the bd_estimateFee method, which estimates the required fee to get your transaction confirmed on the network.

curl -X POST https://svc.blockdaemon.com/ethereum/mainnet/native \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bd_estimateFee"
}'

The response will provide fee estimations in three categories: fast, medium, and slow.

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "estimatedFees": {
            "fast": {
                "maxPriorityFee": "0x1e21cfcbe",
                "maxTotalFee": "0x4435d69a7"
            },
            "medium": {
                "maxPriorityFee": "0x47868c00",
                "maxTotalFee": "0x23a8b4df1"
            },
            "slow": {
                "maxPriorityFee": "0x3b9aca00",
                "maxTotalFee": "0x21d2c9e30"
            }
        },
        "mostRecentBlock": "0x13f1c5b"
    }
}

Using Ethereum RPC Method

Here is a cURL example for using eth_blockNumber to get the current block number in Ethereum Mainnet:

curl -X POST https://svc.blockdaemon.com/ethereum/mainnet/native \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 1
}'

The following is a typical response you will get:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0xe9c344"
}

👋 Need Help?

Contact us through email or our support page for any issues, bugs, or assistance you may need.