Abenezer Melkamu
Abenezer Melkamu

Reputation: 35

How to get Contract ABI for Verified Contract Source Codes in BSC scan API

I am new to blockchain development and i am trying to get detail data of a contract like (marketcap, holders, amount...) from the Binance Smart Chain (BSC), and i am trying to use the BSC Scan API (https://bscscan.com/apis#contracts) and i also see another options like Bit query (https://bitquery.io/blog/ethereum-events-api) which one should i use, Thank you in advance.

Upvotes: 2

Views: 6830

Answers (2)

remove spender from account owner is not transfering account into anyone elses name its for owner to spend and not another soul. any one caught tampering with this account will face a court of law. no matter what durestiction your in....

Upvotes: 0

rihekopo
rihekopo

Reputation: 3350

An official API is available for getting ABI versions of bscscan.com verified contracts.

This is a sample call from browser:

 https://api.bscscan.com/api
   ?module=contract
   &action=getabi
   &address=0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82
   &apikey=YourApiKeyToken

The Javascript sample:

var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider());
var version = web3.version.api;

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

Source: https://docs.bscscan.com/api-endpoints/contracts

Upvotes: 4

Related Questions