{"id":16284983,"url":"https://github.com/goodforgod/java-etherscan-api","last_synced_at":"2025-03-20T02:31:24.744Z","repository":{"id":41040445,"uuid":"155629163","full_name":"GoodforGod/java-etherscan-api","owner":"GoodforGod","description":"🔗 Polished Java library for EtherScan.io API","archived":false,"fork":false,"pushed_at":"2024-01-15T09:40:14.000Z","size":595,"stargazers_count":54,"open_issues_count":2,"forks_count":41,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-28T22:43:27.871Z","etag":null,"topics":["api","api-wrapper","ethereum","etherscan","etherscan-api","etherscan-io","java","wrapper"],"latest_commit_sha":null,"homepage":"https://etherscan.io","language":"Java","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/GoodforGod.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2018-10-31T22:05:09.000Z","updated_at":"2025-02-01T15:31:16.000Z","dependencies_parsed_at":"2024-01-15T10:59:46.164Z","dependency_job_id":"3e96593c-4d08-48a6-8357-3b5ec949a6c5","html_url":"https://github.com/GoodforGod/java-etherscan-api","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fjava-etherscan-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fjava-etherscan-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fjava-etherscan-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoodforGod%2Fjava-etherscan-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoodforGod","download_url":"https://codeload.github.com/GoodforGod/java-etherscan-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047544,"owners_count":20389203,"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":["api","api-wrapper","ethereum","etherscan","etherscan-api","etherscan-io","java","wrapper"],"created_at":"2024-10-10T19:21:48.483Z","updated_at":"2025-03-20T02:31:24.267Z","avatar_url":"https://github.com/GoodforGod.png","language":"Java","readme":"# Java EtherScan API \n\n[![Minimum required Java version](https://img.shields.io/badge/Java-1.8%2B-blue?logo=openjdk)](https://openjdk.org/projects/jdk8/)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.goodforgod/java-etherscan-api)\n[![Java CI](https://github.com/GoodforGod/java-etherscan-api/workflows/CI%20Master/badge.svg)](https://github.com/GoodforGod/java-etherscan-api/actions?query=workflow%3ACI+Master)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GoodforGod_java-etherscan-api\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=GoodforGod_java-etherscan-api)\n\n[Etherscan.io](https://docs.etherscan.io/) Java API implementation.\n\nLibrary supports EtherScan *API* for all available *Ethereum Networks* for *etherscan.io*\n\n## Dependency :rocket:\n\n**Gradle**\n```groovy\nimplementation \"com.github.goodforgod:java-etherscan-api:2.1.0\"\n```\n\n**Maven**\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.goodforgod\u003c/groupId\u003e\n    \u003cartifactId\u003ejava-etherscan-api\u003c/artifactId\u003e\n    \u003cversion\u003e2.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Content\n- [Ethereum Networks](#mainnet-and-testnets)\n- [Custom HttpClient](#custom-httpclient)\n- [API examples](#api-examples)\n    - [Account](#account-api)\n    - [Block](#block-api)\n    - [Contract](#contract-api)\n    - [Logs](#logs-api)\n    - [Proxy](#proxy-api)\n    - [Stats](#stats-api)\n    - [Transactions](#transaction-api)\n    - [Token](#token-api)\n- [Version History](#version-history)\n\n## MainNet and TestNets\n\nAPI support all Ethereum [default networks](https://docs.etherscan.io/getting-started/endpoint-urls):\n- [Mainnet](https://api.etherscan.io/)\n- [Goerli](https://api-goerli.etherscan.io/)\n- [Sepolia](https://api-sepolia.etherscan.io/)\n\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nEtherScanAPI apiGoerli = EtherScanAPI.builder().withNetwork(EthNetworks.GORLI).build();\nEtherScanAPI apiSepolia = EtherScanAPI.builder().withNetwork(EthNetworks.SEPOLIA).build();\n```\n\n### Custom Network\n\nIn case you want to use API for other EtherScan compatible network, you can easily provide custom network with domain api URI.\n\n```java\nEtherScanAPI api = EtherScanAPI.builder()\n        .withNetwork(() -\u003e URI.create(\"https://api-my-custom.etherscan.io/api\"))\n        .build();\n```\n\n## Custom HttpClient\n\nIn case you need to set custom timeout, custom headers or better implementation for HttpClient, \njust implement **EthHttpClient** by your self or initialize it with your values.\n\n```java\nSupplier\u003cEthHttpClient\u003e ethHttpClientSupplier = () -\u003e new UrlEthHttpClient(Duration.ofMillis(300), Duration.ofMillis(300));\nEtherScanAPI api = EtherScanAPI.builder()\n    .withHttpClient(supplier)\n    .build();\n```\n\n## API Examples\n\nYou can read about all API methods on [Etherscan](https://docs.etherscan.io/api-endpoints/accounts)\n\n*Library support all available EtherScan API.*\n\nYou can use library *with or without* API key *([Check API request\\sec restrictions when used without API key](https://docs.etherscan.io/getting-started/viewing-api-usage-statistics))*.\n\nLibrary will automatically limit requests up to **1 requests in 5 seconds** when used *without* key and up to **5 requests in 1 seconds** when used with API KEY (free plan).\n```java\nEtherScanAPI.builder()\n        .withApiKey(ApiRunner.API_KEY)\n        .build();\n```\n\nBelow are examples for each API category.\n\n### Account API\n\n**Get Ether Balance for a single Address**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nBalance balance = api.account().balance(\"0x8d4426f94e42f721C7116E81d6688cd935cB3b4F\");\n```\n\n### Block API\n\n**Get uncles block for block height**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nOptional\u003cUncleBlock\u003e uncles = api.block().uncles(200000);\n```\n\n### Contract API\n**Request contract ABI from [verified codes](https://etherscan.io/contractsVerified)**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nAbi abi = api.contract().contractAbi(\"0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413\");\n```\n\n### Logs API\n\n**Get event logs for single topic**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nLogQuery query = LogQuery.builder(\"0x33990122638b9132ca29c723bdf037f1a891a70c\")\n           .withTopic(\"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545\")\n           .build();\nList\u003cLog\u003e logs = api.logs().logs(query);\n```\n\n**Get event logs for 3 topics with respectful operations**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nLogQuery query = LogQuery.builder(\"0x33990122638b9132ca29c723bdf037f1a891a70c\")\n        .withBlockFrom(379224)\n        .withBlockTo(400000)\n        .withTopic(\"0xf63780e752c6a54a94fc52715dbc5518a3b4c3c2833d301a204226548a2a8545\",\n        \"0x72657075746174696f6e00000000000000000000000000000000000000000000\",\n        \"0x72657075746174696f6e00000000000000000000000000000000000000000000\")\n        .setOpTopic0_1(LogOp.AND)\n        .setOpTopic0_2(null)\n        .setOpTopic1_2(LogOp.AND)\n        .build();\n \nList\u003cLog\u003e logs = api.logs().logs(query);\n```\n\n### Proxy API\n\n**Get tx details with proxy endpoint**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nOptional\u003cTxProxy\u003e tx = api.proxy().tx(\"0x1e2910a262b1008d0616a0beb24c1a491d78771baa54a33e66065e03b1f46bc1\");\n```\n\n**Get block info with proxy endpoint**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nOptional\u003cBlockProxy\u003e block = api.proxy().block(15215);\n```\n\n### Stats API\n\n**Statistic about last price**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nPrice price = api.stats().priceLast();\n```\n\n### Transaction API\n\n**Request receipt status for tx**\n```java\nEtherScanAPI api = EtherScanAPI.builder().build();\nOptional\u003cBoolean\u003e status = api.txs().receiptStatus(\"0x513c1ba0bebf66436b5fed86ab668452b7805593c05073eb2d51d3a52f480a76\");\n```\n\n### Token API\n\nYou can read about token API [here](https://docs.etherscan.io/api-endpoints/tokens)\n\nToken API methods migrated to [Account](#account-api) \u0026 [Stats](#stats-api) respectfully.\n\n## License\n\nThis project licensed under the MIT - see the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodforgod%2Fjava-etherscan-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoodforgod%2Fjava-etherscan-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoodforgod%2Fjava-etherscan-api/lists"}