Skip to content

Etherscan API V1 has been deprecated #4016

@paulkuhle

Description

@paulkuhle

The Etherscan V1 API has now been fully deprecated. Any request to V1 endpoints throw the following error message:

{"status":"0","message":"NOTOK","result":"You are using a deprecated V1 endpoint, switch to Etherscan API V2 using https://docs.etherscan.io/v2-migration"}

Chifra uses the V1 API to download ABI files from Etherscan (both for the --articulate flag and for the chifra abis CLI command). The relevant code is in src/apps/chifra/pkg/abi/download.go:

	url := fmt.Sprintf(
		"https://api.etherscan.io/api?module=contract&action=getabi&address=%s&apikey=%s",
		address.Hex(),
		key,
	)

This may go unnoticed for a while if you have a large ABI cache and don't need to query from source. It should be easy enough to reproduce by removing an ABI and then re-fetching it:

chifra abis 0xdac17f958d2ee523a2206206994597c13d831ec7 -D
chifra abis 0xdac17f958d2ee523a2206206994597c13d831ec7

I was able to fix this locally by replacing the V1 URL with the new V2 URL:

	url := fmt.Sprintf(
		"https://api.etherscan.io/v2/api?chainid=1&module=contract&action=getabi&address=%s&apikey=%s",
		address.Hex(),
		key,
	)

According to the migration guide, you just need to change the base URL. The rest is a drop-in replacement.

I'd be happy to open a PR with this fix, but given that there's a TODO in the file mentioning a possible rewrite I wanted to open this as an issue first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions