How to Access Fantom API

❗️

Blockdaemon to end Fantom support on April 15, 2025.

Blockdaemon will stop supporting the Fantom protocol on April 15, 2025. After this date, we will no longer provide operational support or services for Fantom Dedicated Nodes and RPC API.

Step 1: To access Fantom, use the native access endpoint with http-rpc at the end:

  • Network: Fantom Mainnet
  • Request Type: POST
https://svc.blockdaemon.com/fantom/mainnet/native/http-rpc
  • Network: Fantom Testnet
  • Request Type: POST
https://svc.blockdaemon.com/fantom/testnet/native/http-rpc

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

Step 3: Specify a Fantom method in the request body:

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

Example Request

Here is a cURL example for using eth_getBalance to get the balance of the account specified by address.

curl -X \
POST https://svc.blockdaemon.com/fantom/mainnet/native/http-rpc \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' 
-d '{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": ["0x4399F61795d3e50096E236A6D31ab24470c99fd5", "latest"],
    "id": 0
}'

The following is a typical response you will get:

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

Here is a cURL example for using eth_getLogs to get all logs matching a given filter object.

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

The following is a typical response you will get:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
        {
            "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "topics": [
                "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
                "0x0000000000000000000000009acbb72cf67103a30333a32cd203459c6a9c3311",
                "0x000000000000000000000000994871e1103c5da4be270365fa62771ea4525520"
            ],
            "data": "0x000000000000000000000000000000000000000000000000000000001ec39aa0",
            "blockNumber": "0xf6289d",
            "transactionHash": "0xc7ed73c9b219d4243872e5993ad2950c8ea87d15af28562d33b0c05d46a90cee",
            "transactionIndex": "0x1e",
            "blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
            "logIndex": "0x13",
            "removed": false
        }
    ]
}

👋 Need Help?

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