BLN POA chain developer API's

SVG

Access Blockchain Data

SVG

Building DAPPs

SVG

Verify Contracts

SVG

Community Driven

Introduction


The BLN PoA Chain 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 polygonscan.com APIs" is required except for personal/private usage.



Get Historical BLN Balance for a single Address By BlockNo

https://api.bullionscan.io/api?module=account&action=balancehistory&address=0x0000000000000000000000000000000000001010&blockno=1000&api_key=YourApiKeyToken
                                
* The above API endpoint is throttled to 2 calls/second regardless of API Pro tier.

Get Daily Average Block Size

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailyavgblocksize&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken

Get Daily Block Count and Rewards

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailyblkcount&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken

Get Daily Block Rewards

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailyblockrewards&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken

Get Daily Average Block Time for A Block to be Included in the BLN PoS Chain

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailyavgblocktime&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Historical ERC20-Token TotalSupply by ContractAddress & BlockNo

https://api.bullionscan.io/api?module=stats&action=tokensupplyhistory&contractaddress=0xc9849e6fdb743d08faee3e34dd2d1bc69ea11a51&blockno=4000000&api_key=YourApiKeyToken
* The above API endpoint is throttled to 2 calls/second regardless of API Pro tier.

Get Historical ERC20-Token Account Balance for TokenContractAddress by BlockNo

https://api.bullionscan.io/api?module=account&action=tokenbalancehistory&contractaddress=0xc9849e6fdb743d08faee3e34dd2d1bc69ea11a51&address=0x7bb89460599dbf32ee3aa50798bbceae2a5f7f6a&blockno=4000000&api_key=YourApiKeyToken
* The above API endpoint is throttled to 2 calls/second regardless of API Pro tier.

Get Token Info by ContractAddress

https://api.bullionscan.io/api?module=token&action=tokeninfo&contractaddress=0xc9849e6fdb743d08faee3e34dd2d1bc69ea11a51&api_key=YourApiKeyToken
* The above API endpoint is throttled to 2 calls/second regardless of API Pro tier.

Sample return of token info API:

    {
      "status": "1",
      "message": "OK",
      "result": [
        {
          "contractAddress": "0x...",
          "tokenName": "Token Name",
          "symbol": "BLN Symbol",
          "divisor": "18",
          "tokenType": "ERC20",
          "totalSupply": "1000000000000000",
          "blueCheckmark": "true",
          "description": "Token Description",
          "website": "https://BLN.website",
          "email": "email@BLN.website",
          "blog": "https://blog.BLN.website/",
          "reddit": "https://www.reddit.com/r/BLN/",
          "slack": "https://chat.BLN.website/",
          "facebook": "https://facebook.com/BLN",
          "twitter": "https://twitter.com/BLN",
          "bitcointalk": "https://www.BLN.org/index.php?topic=xxxxx",
          "github": "https://github.com/BLN",
          "telegram": "https://t.me/BLN",
          "wechat": "https://token.website/BLN",
          "linkedin": "https://www.linkedin.com/BLN/",
          "discord": "https://discord.com/BLN",
          "whitepaper": "https://BLN.website/documents/document.pdf",
          "tokenPriceUSD": "00.00"
        }
      ]
    }
                                

Get Daily Average Gas Limit

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailyavggaslimit&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get BLN PoS Chain Daily Total Gas Used

[Parameters] startdate and enddate format 'yyyy-MM-dd'

https://api.bullionscan.io/api?module=stats&action=dailygasused&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Daily Average Gas Price

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=dailyavggasprice&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Daily Network Transaction Fee

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=dailytxnfee&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Daily New Address Count

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=dailynewaddress&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Daily Network Utilization

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=dailynetutilization&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get Daily Transaction Count

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=dailytx&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

Get MATIC Historical Price

[Parameters] startdate and enddate format 'yyyy-MM-dd'

                                    https://api.bullionscan.io/api?module=stats&action=maticdailyprice&startdate=2020-10-01&enddate=2020-10-31&sort=asc&api_key=YourApiKeyToken
                                

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.bullionscan.io/api?module=contract&action=getabi&address=0x0000000000000000000000000000000000001010&api_key=YourApiKeyToken', function (data) {
    var contractABI = "";
        contractABI = JSON.parse(data.result);
        if (contractABI != ''){
            var MyContract = web3.eth.contract(contractABI);
            var myContractInstance = MyContract.at("0x0000000000000000000000000000000000001010");
            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.bullionscan.io/api?module=contract&action=getsourcecode&address=0x2791bca1f2de4661ed88a30c99a7a9449aa84174&api_key=YourApiKeyToken (replace the address parameter with the actual contract address)

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

Verify Source Code (beta)

                                    1. Requires a valid BLN APIkey, will reject if otherwise
2. Current daily limit of 100 submissions per day per user (subject to change)
3. Only supports HTTP post due to max transfer size limitations for http get
4. Supports up to 10 different library pairs
5. Contracts that use "imports" will need to have the code concatenated into one file as we do not support "imports" in separate files. You can try using the Blockcat solidity-flattener or SolidityFlattery
6. List of supported solc versions, only solc version v0.4.11 and above is supported. Ex. v0.4.25+commit.59dbf8f1
7. Upon successful submission you will receive a GUID (50 characters) as a receipt.
8. You may use this GUID to track the status of your submission
9. Verified Source Codes will be displayed at contractsVerified

See Demo Source Verification Submission Code at Source Code Verification Sample

Source Code Submission Gist (returns a guid as part of the result upon success):

    //Submit Source Code for Verification
    $.ajax({
        type: "POST",                       //Only POST supported  
        url: "//api.bullionscan.io/api", //Set to the  correct API url for Other Networks
        data: {
            apikey: $('#apikey').val(),                     //A valid API-Key is required        
            module: 'contract',                             //Do not change
            action: 'verifysourcecode',                     //Do not change
            contractaddress: $('#contractaddress').val(),   //Contract Address starts with 0x...     
            sourceCode: $('#sourceCode').val(),             //Contract Source Code (Flattened if necessary)
            codeformat: $('#codeformat').val(),             //solidity-single-file (default) or solidity-standard-json-input (for std-input-json-format support
            contractname: $('#contractname').val(),         //ContractName (if codeformat=solidity-standard-json-input, then enter contractname as ex: erc20.sol:erc20)
            compilerversion: $('#compilerversion').val(),   // see https://bullionscan.io/ for list of support versions
            optimizationUsed: $('#optimizationUsed').val(), //0 = No Optimization, 1 = Optimization used (applicable when codeformat=solidity-single-file)
            runs: 200,                                      //set to 200 as default unless otherwise  (applicable when codeformat=solidity-single-file)        
            constructorArguements: $('#constructorArguements').val(),   //if applicable
            evmversion: $('#evmVersion').val(),             //leave blank for compiler default, homestead, tangerineWhistle, spuriousDragon, byzantium, constantinople, petersburg, istanbul (applicable when codeformat=solidity-single-file)
            licenseType: $('#licenseType').val(),           //Valid codes 1-12 where 1=No License .. 12=Apache 2.0, see https://bullionscan.io
            libraryname1: $('#libraryname1').val(),         //if applicable, a matching pair with libraryaddress1 required
            libraryaddress1: $('#libraryaddress1').val(),   //if applicable, a matching pair with libraryname1 required
            libraryname2: $('#libraryname2').val(),         //if applicable, matching pair required
            libraryaddress2: $('#libraryaddress2').val(),   //if applicable, matching pair required
            libraryname3: $('#libraryname3').val(),         //if applicable, matching pair required
            libraryaddress3: $('#libraryaddress3').val(),   //if applicable, matching pair required
            libraryname4: $('#libraryname4').val(),         //if applicable, matching pair required
            libraryaddress4: $('#libraryaddress4').val(),   //if applicable, matching pair required
            libraryname5: $('#libraryname5').val(),         //if applicable, matching pair required
            libraryaddress5: $('#libraryaddress5').val(),   //if applicable, matching pair required
            libraryname6: $('#libraryname6').val(),         //if applicable, matching pair required
            libraryaddress6: $('#libraryaddress6').val(),   //if applicable, matching pair required
            libraryname7: $('#libraryname7').val(),         //if applicable, matching pair required
            libraryaddress7: $('#libraryaddress7').val(),   //if applicable, matching pair required
            libraryname8: $('#libraryname8').val(),         //if applicable, matching pair required
            libraryaddress8: $('#libraryaddress8').val(),   //if applicable, matching pair required
            libraryname9: $('#libraryname9').val(),         //if applicable, matching pair required
            libraryaddress9: $('#libraryaddress9').val(),   //if applicable, matching pair required
            libraryname10: $('#libraryname10').val(),       //if applicable, matching pair required
            libraryaddress10: $('#libraryaddress10').val()  //if applicable, matching pair required
        },
        success: function (result) {
            console.log(result);
            if (result.status == "1") {
                //1 = submission success, use the guid returned (result.result) to check the status of your submission.
                // Average time of processing is 30-60 seconds
                document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
                // result.result is the GUID receipt for the submission, you can use this guid for checking the verification status
            } else {
                //0 = error
                document.getElementById("postresult").innerHTML = result.status + ";" + result.message + ";" + result.result;
            }
            console.log("status : " + result.status);
            console.log("result : " + result.result);
        },
        error: function (result) {
            console.log("error!");
            document.getElementById("postresult").innerHTML = "Unexpected Error"
        }
    });
                                

Check Source code verification submission status:

    //Check Source Code Verification Status
    $.ajax({
        type: "GET",
        url: "//api.bullionscan.io/api",
        data: {
            apikey: $('#apikey').val(), 
            guid: 'tgertert436346436436', //Replace with your Source Code GUID receipt above
            module: "contract",
            action: "checkverifystatus"
        },
        success: function (result) {
            console.log("status : " + result.status);   //0=Error, 1=Pass 
            console.log("message : " + result.message); //OK, NOTOK
            console.log("result : " + result.result);   //result explanation
            $('#guidstatus').html(">> " + result.result);
        },
        error: function (result) {
            alert('error');
        }
    });

Transaction APIs

Blocks APIs


Get Block Number by Timestamp

[Parameters] timestamp format: Unix timestamp (supports Unix timestamps in seconds), closest value: 'before' or 'after'

                                    https://api.bullionscan.io/api?module=block&action=getblocknobytime&timestamp=1601510400&closest=before&api_key=YourApiKeyToken
                                

Logs APIs


The Event Log API was designed to provide an alternative to the native eth_getLogs. Below are the list of supported filter parameters:

  • fromBlock, toBlock, address
  • topic0, topic1, topic2, topic3 (32 Bytes per topic)
  • topic0_1_opr (and|or between topic0 & topic1), topic1_2_opr (and|or between topic1 & topic2), topic2_3_opr (and|or between topic2 & topic3), topic0_2_opr (and|or between topic0 & topic2), topic0_3_opr (and|or between topic0 & topic3), topic1_3_opr (and|or between topic1 & topic3)

- FromBlock & ToBlock accepts the blocknumber (integer, NOT hex) or 'latest' (earliest & pending is NOT supported yet)
- Topic Operator (opr) choices are either 'and' or 'or' and are restricted to the above choices only
- FromBlock & ToBlock parameters are required
- An address and/or topic(X) parameters are required, when multiple topic(X) parameters are used the topicX_X_opr (and|or operator) is also required
- For performance & security considerations, only the first 1000 results are return. So please narrow down the filter parameters


Here are some examples of how this filter maybe used:

Get Event Logs from block number 5000000 to 6000000 Block, where log address = 0x0000000000000000000000000000000000001010 and topic[0] = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef

                                    https://api.bullionscan.io/api?module=logs&action=getLogs
&fromBlock=5000000
&toBlock=6000000
&address=0x0000000000000000000000000000000000001010
&topic0=0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
&api_key=YourApiKeyToken

Get Event Logs from block number 5000000 to block 6000000 , where log address = 0x0000000000000000000000000000000000001010, topic[0] = 0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63 'AND' topic[1] = 0x0000000000000000000000000000000000000000000000000000000000001010

                                    https://api.bullionscan.io/api?module=logs&action=getLogs
&fromBlock=5000000
&toBlock=6000000
&address=0x0000000000000000000000000000000000001010
&topic0=0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63
&topic0_1_opr=and
&topic1=0x0000000000000000000000000000000000000000000000000000000000001010
&api_key=YourApiKeyToken

Geth/Parity Proxy APIs


The following are the limited list of supported Proxied APIs for Geth available through PolygonScan.


eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block from a block matching the given block number

                                    https://api.bullionscan.io/api?module=proxy&action=eth_getBlockTransactionCountByNumber&tag=0x989680&api_key=YourApiKeyToken
                                

eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position

                                    https://api.bullionscan.io/api?module=proxy&action=eth_getTransactionByBlockNumberAndIndex&tag=0x989680&index=0x0&api_key=YourApiKeyToken
                                

eth_sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions

                                    https://api.bullionscan.io/api?module=proxy&action=eth_sendRawTransaction&hex=0xf904808000831cfde080&api_key=YourApiKeyToken
                                

(Replace the hex value with your raw hex encoded transaction that you want to send.
Send as a POST request, if your hex code is particularly long)

eth_call

Executes a new message call immediately without creating a transaction on the block chain

                                    https://api.bullionscan.io/api?module=proxy&action=eth_call&to=0xAEEF46DB4855E25702F8237E8f403FddcaF931C0&data=0x70a08231000000000000000000000000e16359506c028e51f16be38986ec5746251e9724&tag=latest&api_key=YourApiKeyToken
                                

(The gas parameter to eth_call is capped at 2x the current block gas limit)

eth_estimateGas

Makes a call or transaction, which won't be added to the blockchain and returns the used gas, which can be used for estimating the used gas

                                    https://api.bullionscan.io/api?module=proxy&action=eth_estimateGas&data=0x4e71d92d&to=0xf0160428a8552ac9bb7e050d90eeade4ddd52843&value=0xff22&gasPrice=0x51da038cc&gas=0x5f5e0ff&api_key=YourApiKeyToken
                                

(The gas parameter to eth_estimateGas is capped at 2x the current block gas limit)

General Stats APIs


Get Total Supply of MATIC on the BLN PoS Chain

                                    https://api.bullionscan.io/api?module=stats&action=maticsupply&api_key=YourApiKeyToken
                                

(Result returned in Wei, to get value in MATIC divide the returned results by 1000000000000000000)

Public BLN RPC Nodes


Mainnet BLN RPC Nodes

                                    Mainnet BLN RPC Endpoints (ChainID 137):

https://bullionscan.io

Testnet BLN RPC Nodes

                                    Testnet BLN RPC Endpoints (ChainID 80001):

https://bullionscan.io/

Usage Notes:

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

## mainnet
geth attach https://bullionscan.io

## testnet
geth attach https://bullionscan.io

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