{"id":15630394,"url":"https://github.com/nanmu42/etherscan-api","last_synced_at":"2025-04-04T18:09:26.197Z","repository":{"id":34034103,"uuid":"142669284","full_name":"nanmu42/etherscan-api","owner":"nanmu42","description":":guitar: Golang client for Ethereum Etherscan API (and its families like BscScan) / Golang 以太坊 Etherscan API库（也支持同一家族的BscScan）","archived":false,"fork":false,"pushed_at":"2024-07-19T08:03:07.000Z","size":108,"stargazers_count":241,"open_issues_count":7,"forks_count":110,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T17:10:01.106Z","etag":null,"topics":["bscscan","eth","ethereum","ethereum-etherscan","etherscan","etherscan-api","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanmu42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"nanmu42"}},"created_at":"2018-07-28T10:42:03.000Z","updated_at":"2025-03-17T16:25:49.000Z","dependencies_parsed_at":"2024-06-18T13:37:56.889Z","dependency_job_id":"bf17b3a7-cd62-42b5-ab1b-aba96ce030c8","html_url":"https://github.com/nanmu42/etherscan-api","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanmu42%2Fetherscan-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanmu42%2Fetherscan-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanmu42%2Fetherscan-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanmu42%2Fetherscan-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanmu42","download_url":"https://codeload.github.com/nanmu42/etherscan-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226215,"owners_count":20904465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bscscan","eth","ethereum","ethereum-etherscan","etherscan","etherscan-api","go","golang"],"created_at":"2024-10-03T10:32:33.234Z","updated_at":"2025-04-04T18:09:26.179Z","avatar_url":"https://github.com/nanmu42.png","language":"Go","funding_links":["https://github.com/sponsors/nanmu42"],"categories":[],"sub_categories":[],"readme":"**English** | [中文](https://github.com/nanmu42/etherscan-api/blob/master/README_ZH.md)\n\n# etherscan-api\n\n[![GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api?status.svg)](https://godoc.org/github.com/nanmu42/etherscan-api)\n[![CI status](https://github.com/nanmu42/etherscan-api/actions/workflows/ci.yaml/badge.svg)](https://github.com/nanmu42/etherscan-api/actions)\n[![codecov](https://codecov.io/gh/nanmu42/etherscan-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nanmu42/etherscan-api)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nanmu42/etherscan-api)](https://goreportcard.com/report/github.com/nanmu42/etherscan-api)\n\nGolang client for the Etherscan.io API(and its families like BscScan), with nearly full implementation(accounts, transactions, tokens, contracts, blocks, stats), full network support(Mainnet, Ropsten, Kovan, Rinkby, Goerli, Tobalaba), and only depending on standard library. :wink:\n\n# Usage\n\n```bash\ngo get github.com/nanmu42/etherscan-api\n```\n\nCreate an API instance and off you go. :rocket:\n\n```go\nimport (\n\t\"github.com/nanmu42/etherscan-api\"\n\t\"fmt\"\n)\n\nfunc main() {\n\t// create a API client for specified ethereum net\n\t// there are many pre-defined network in package\n\tclient := etherscan.New(etherscan.Mainnet, \"[your API key]\")\n\t\n\t// or, if you are working with etherscan-family API like BscScan\n\t//\n\t// client := etherscan.NewCustomized(etherscan.Customization{\n\t// Timeout:       15 * time.Second,\n\t// Key:           \"You key here\",\n\t// BaseURL:       \"https://api.bscscan.com/api?\",\n\t// Verbose:       false,\n\t// })\n\n\t// (optional) add hooks, e.g. for rate limit\n\tclient.BeforeRequest = func(module, action string, param map[string]interface{}) error {\n\t\t// ...\n\t}\n\tclient.AfterRequest = func(module, action string, param map[string]interface{}, outcome interface{}, requestErr error) {\n\t\t// ...\n\t}\n\n\t// check account balance\n\tbalance, err := client.AccountBalance(\"0x281055afc982d96fab65b3a49cac8b878184cb16\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// balance in wei, in *big.Int type\n\tfmt.Println(balance.Int())\n\n\t// check token balance\n\ttokenBalance, err := client.TokenBalance(\"contractAddress\", \"holderAddress\")\n\n\t// check ERC20 transactions from/to a specified address\n\ttransfers, err := client.ERC20Transfers(\"contractAddress\", \"address\", startBlock, endBlock, page, offset)\n}\n```\n\nYou may find full method list at [GoDoc](https://godoc.org/github.com/nanmu42/etherscan-api).\n\n# Etherscan API Key\n\nYou may apply for an API key on [etherscan](https://etherscan.io/apis).\n\n\u003e The Etherscan Ethereum Developer APIs are provided as a community service and without warranty, so please just use what you need and no more. They support both GET/POST requests and a rate limit of 5 requests/sec (exceed and you will be blocked). \n\n# Paperwork Things\n\nI am not from Etherscan and I just find their service really useful, so I implement this. :smile:\n\n# License\n\nUse of this work is governed by an MIT License.\n\nYou may find a license copy in project root.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanmu42%2Fetherscan-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanmu42%2Fetherscan-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanmu42%2Fetherscan-api/lists"}