1

I have the address but I want to know the name of contract. Is there any way to get that from the etherscan API?

0

There is no special API method to get the name of contract. But if you are talking about ERC20 Tokens, you can try another method [BETA]:

https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&page=1&offset=5

It returns ERC20 token transfer events for a specific contract. So you can extract required information "tokenName":"Maker","tokenSymbol":"MKR" from the response.

0

getsourcecode Etherscan API endpoint returns the name of a contract. You can find the description of the endpoint here: https://etherscan.io/apis#contracts

https://api.etherscan.io/api?module=contract&action=getsourcecode&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyToken

It returns `` in the resulting JSON:

{
    "status": "1",
    "message": "OK",
    "result": [{
        ...,
        "ContractName": "..."
    }]
}

Also, you can find a similar API endpoint in Blockscout, that you can use even without API key. For instance, https://blockscout.com/eth/mainnet/api?module=contract&action=getsourcecode&address=0x5085c5356129ee11bffb523e3166d7153ac13c75

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.