Fantom Developer APIs

SVG

Access Blockchain Data

SVG

Building DAPPs

SVG

Verify Contracts

SVG

Community Driven

Introduction


The Fantom Developer APIs are provided as a community service and without warranty, so please use what you need and no more. We support both GET/POST requests and there is a rate limit of 5 calls per sec/IP.

Note: Source attribution via a link back or mention that your app is "Powered by FtmScan.com APIs" is required except for personal/private usage.


Account APIs


Get a list of 'Normal' Transactions By Address

[Optional Parameters] startblock: starting blockNo to retrieve results, endblock: ending blockNo to retrieve results

                                    https://api-testnet.ftmscan.com/api?module=account&action=txlist&address=0xba821dc848803900C01BA7Ac1D7a034B95B1eD97&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken
                                

(Returned 'isError' values: 0=No Error, 1=Got Error)

(Returns up to a maximum of the last 10000 transactions only)

or

                                    https://api-testnet.ftmscan.com/api?module=account&action=txlist&address=0xba821dc848803900C01BA7Ac1D7a034B95B1eD97&startblock=0&endblock=99999999&page=1&offset=10&sort=asc&apikey=YourApiKeyToken
                                

(To get paginated results use page=<page number> and offset=<max records to return>)


Get a list of "ERC-20 - Token Transfer Events" by Address

[Optional Parameters] startblock: starting blockNo to retrieve results, endblock: ending blockNo to retrieve results

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokentx&address=0xba821dc848803900C01BA7Ac1D7a034B95B1eD97&startblock=0&endblock=999999999&sort=asc&apikey=YourApiKeyToken
                                

(Returns up to a maximum of the last 10000 transactions only)

or

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokentx&contractaddress=0xddcb3ffd12750b45d32e084887fdf1aabab34239&page=1&offset=100&sort=asc&apikey=YourApiKeyToken
                                

(To get paginated results use page=<page number> and offset=<max records to return>)

or

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokentx&contractaddress=0xddcb3ffd12750b45d32e084887fdf1aabab34239&address=0xba821dc848803900C01BA7Ac1D7a034B95B1eD97&page=1&offset=100&sort=asc&apikey=YourApiKeyToken
                                

(To get transfer events for a specific token contract, include the contractaddress parameter)


Get a list of "ERC721 - Token Transfer Events" by Address

[Optional Parameters] startblock: starting blockNo to retrieve results, endblock: ending blockNo to retrieve results

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokennfttx&address=0x0897cf572c8dac35126c8198b9ba2f300ed61b51&startblock=0&endblock=999999999&sort=asc
                                

(Returns up to a maximum of the last 10000 transactions only)

or

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokennfttx&contractaddress=0x23fEbaC82FE117D146C8125B0bE6499797Ec71Ff&page=1&offset=100&sort=asc
                                

(To get paginated results use page=<page number> and offset=<max records to return>)

or

                                    https://api-testnet.ftmscan.com/api?module=account&action=tokennfttx&contractaddress=0x23febac82fe117d146c8125b0be6499797ec71ff&address=0x0000000000000000000000000000000000000000&page=1&offset=100&sort=asc
                                

(To get transfer events for a specific token contract, include the contractaddress parameter)

Contract APIs

A simple sample for retrieving the contractABI using Web3.js and Jquery to interact with a contract

    var Web3 = require('web3');
    var web3 = new Web3(new Web3.providers.HttpProvider());
    var version = web3.version.api;
            
    $.getJSON('https://api.ftmscan.com/api?module=contract&action=getabi&address=0x80AA7cb0006d5DDD91cce684229Ac6e398864606&apikey=YourApiKeyToken', function (data) {
    var contractABI = "";
        contractABI = JSON.parse(data.result);
        if (contractABI != ''){
            var MyContract = web3.eth.contract(contractABI);
            var myContractInstance = MyContract.at("0x80AA7cb0006d5DDD91cce684229Ac6e398864606");
            var result = myContractInstance.memberId("0xfe8ad7dd2f564a877cc23feea6c0a9cc2e783715");
            console.log("result1 : " + result);
            var result = myContractInstance.members(1);
            console.log("result2 : " + result);
        } else {
            console.log("Error" );
        }
    });
                                

Get Contract Source Code for Verified Contract Source Codes

                                    1. https://api-testnet.ftmscan.com/api?module=contract&action=getsourcecode&address=0x80AA7cb0006d5DDD91cce684229Ac6e398864606&apikey=YourApiKeyToken (replace the address parameter with the actual contract address)

2. Terms of usage: Please see the usage terms policy

General Stats APIs


Get Total Supply of FTM on the Fantom

                                    https://api-testnet.ftmscan.com/api?module=stats&action=ftmsupply&apikey=YourApiKeyToken
                                

(Result returned in Wei, to get value in FTM divide the ResultAbove/1000000000000000000)

Public FTM RPC Nodes


FTM RPC Nodes

                                    FTM RPC Endpoints (ChainID 250):

https://rpcapi.fantom.network

Usage Notes:

                                    Start
You can start the HTTP JSON-RPC with the --rpc flag

## mainnet
geth attach https://rpcapi.fantom.network

JSON-RPC methods
Please refer to this wiki page or use Postman: https://documenter.getpostman.com/view/4117254/ethereum-json-rpc/RVu7CT5J?version=latest