BaseScan Developer APIs

SVG

Access Blockchain Data

SVG

Building DAPPs

SVG

Verify Contracts

SVG

Community Driven

Introduction


The BaseScan 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 The BaseScan Explorer 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-goerli.basescan.org/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-goerli.basescan.org/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-goerli.basescan.org/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-goerli.basescan.org/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-goerli.basescan.org/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)

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-goerli.basescan.org + "/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-goerli.basescan.org/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