{"id":26562933,"url":"https://github.com/aelfproject/aelf-sdk.java","last_synced_at":"2025-07-03T11:02:35.037Z","repository":{"id":38106901,"uuid":"228003471","full_name":"AElfProject/aelf-sdk.java","owner":"AElfProject","description":"AElf java SDK","archived":false,"fork":false,"pushed_at":"2023-10-26T08:46:50.000Z","size":1573,"stargazers_count":1,"open_issues_count":2,"forks_count":6,"subscribers_count":7,"default_branch":"dev","last_synced_at":"2025-04-08T11:38:25.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AElfProject.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-14T10:21:13.000Z","updated_at":"2023-03-09T13:58:47.000Z","dependencies_parsed_at":"2023-10-20T12:27:57.284Z","dependency_job_id":null,"html_url":"https://github.com/AElfProject/aelf-sdk.java","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/AElfProject/aelf-sdk.java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AElfProject","download_url":"https://codeload.github.com/AElfProject/aelf-sdk.java/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AElfProject%2Faelf-sdk.java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263314092,"owners_count":23447289,"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":[],"created_at":"2025-03-22T15:29:20.787Z","updated_at":"2025-07-03T11:02:34.994Z","avatar_url":"https://github.com/AElfProject.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AElf-Client\n\n## Introduction\n\nThis is a Java client library, used to communicate with the [AElf](https://github.com/AElfProject/AElf)  API.\n\n### Getting Started\n\n- Make sure [Oracle Jdk](https://www.oracle.com/java/technologies/javase-downloads.html) is installed.\n- Execute `mvn clean package ` and  `mvn compile `  to build AElfClient (used by test cases).\n\n### System Requirement\n\n- JDK1.8+\n- Log4j2.6.2\n\n### Basic usage\n\n``` JAVA\nprivate static final String httpUrl=\"http://127.0.0.1:8200\";\n\n// get client instance\nAElfClient AElfClient = new AElfClient(httpUrl);\nlong blockHeight = client.getBlockHeight();\n```\n\n### Class\n\n#### AElfClient\n\n``` JAVA\npublic AElfClient(String url);\n    \npublic AElfClient(String url,String version);\n   \npublic TransactionDto generateTransaction(String from, String to, String methodName, String params) throws Exception;\n    \npublic TransactionDto signTransaction(String privateKeyHex,TransactionDto transaction);\n     \npublic String getGenesisContractAddress() throws Exception;\n    \npublic String getAddressFromPrivateKey(String privateKey);\n    \npublic String GetSignatureWithToHex(String privateKey, byte[] txData) throws Exception;\n    \npublic boolean isConnected();\n    \npublic BlockDto getBlockByHash(String blockHash, boolean includeTransactions) throws Exception;\n     \npublic BlockDto getBlockByHeight(long blockHeight, boolean includeTransactions) throws Exception;\n     \npublic BlockStateDto getBlockState(String blockHash) throws  Exception;\n     \npublic ChainstatusDto getChainStatus() throws Exception;\n     \npublic byte[] getContractFileDescriptorSet(String address) throws  Exception;\n     \npublic List\u003cTaskQueueInfoDto\u003e getTaskQueueStatus() throws Exception;\n     \npublic TransactionPoolStatusOutput getTransactionPoolStatus() throws Exception;\n    \npublic KeyPairInfo generateKeyPairInfo() throws Exception;\n    \npublic String executeTransaction(ExecuteTransactionDto input) throws Exception;\n     \npublic CreateRawTransactionOutput createRawTransaction(CreateRawTransactionInput input) throws Exception;\n     \npublic String  executeRawTransaction(ExecuteRawTransactionDto input) throws Exception;\n     \npublic SendRawTransactionOutput sendRawTransaction(SendRawTransactionInput input) throws Exception;\n     \npublic SendTransactionOutput sendTransaction(SendTransactionInput input) throws Exception;\n     \npublic List\u003cString\u003e sendTransactions(SendTransactionsInput input) throws Exception;\n     \npublic TransactionResultDto getTransactionResult(String transactionId) throws Exception;\n     \npublic List\u003cTransactionResultDto\u003e  getTransactionResults(String blockHash, int offset,int limit) throws Exception;\n     \npublic MerklePathDto getMerklePathByTransactionId(String transactionId) throws Exception;\n     \npublic List\u003cTransactionResultDto\u003e  getTransactionResults(String blockHash) throws Exception;\n     \npublic BlockDto getBlockByHeight(long blockHeight) throws Exception;\n     \npublic BlockDto getBlockByHash(String blockHash) throws Exception;\n     \npublic int getChainId() throws Exception;\n    \npublic Boolean addPeer(AddPeerInput input) throws Exception;\n    \npublic Boolean removePeer(String address) throws Exception;\n    \npublic List\u003cPeerDto\u003e getPeers(Boolean withMetrics) throws Exception;\n    \npublic NetworkInfoOutput getNetworkInfo() throws Exception;\n\n```\n\n### ProtoBuff Build\n\nDefault classes defined in the \"protobuf/protos\" are available in the directory named \"protobuf/generated\".\n\nYou can add new types in protos and generate them by using the scripts in \"resources\" folder.\n\n- Windows : `./protobuff.bat `\n- Linux Or Mac: `./protobuff.sh `\n\n\n### Test\n\nThis module contains tests for all services provided by AElfClient. You can learn how to properly use services provided by sdk here.\n\nYou need to firstly set necessary parameters to make sure tests can run successfully.\n\n1. Set baseUrl to your target url.\n\n   ``` JAVA\n   String httpUrl=\"http://127.0.0.1:8200\";\n   ```\n\n2. Give a valid privateKey of a node.\n\n   ``` JAVA\n   String privateKey=\"09da44778f8db2e602fb484334f37df19e221c84c4582ce5b7770ccfbc3ddbef\";\n   ```\n\n### Note\n\nYou need to run a local or remote AElf node to run the unit test successfully. If you're not familiar with how to run a node or multiple nodes, please see [Running a node](https://docs.aelf.io/v/dev/main/main/run-node) / [Running multiple nodes](https://docs.aelf.io/v/dev/main/main/multi-nodes) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf-sdk.java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faelfproject%2Faelf-sdk.java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faelfproject%2Faelf-sdk.java/lists"}