{"id":18416886,"url":"https://github.com/syntifi/casper-sdk","last_synced_at":"2025-04-07T12:32:11.665Z","repository":{"id":42569898,"uuid":"386545621","full_name":"syntifi/casper-sdk","owner":"syntifi","description":"Java 8+ Casper RPC Client SDK","archived":false,"fork":false,"pushed_at":"2022-08-01T19:58:03.000Z","size":19998,"stargazers_count":1,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T18:41:20.613Z","etag":null,"topics":["api-client","casper-network","casperlabs","java","rpc-client","sdk","sdk-java"],"latest_commit_sha":null,"homepage":"https://syntifi.github.io/casper-sdk/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syntifi.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":"SECURITY.md","support":null}},"created_at":"2021-07-16T07:14:15.000Z","updated_at":"2024-02-23T14:20:00.000Z","dependencies_parsed_at":"2022-09-26T21:51:23.619Z","dependency_job_id":null,"html_url":"https://github.com/syntifi/casper-sdk","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fcasper-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fcasper-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fcasper-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntifi%2Fcasper-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntifi","download_url":"https://codeload.github.com/syntifi/casper-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653167,"owners_count":20973775,"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-client","casper-network","casperlabs","java","rpc-client","sdk","sdk-java"],"created_at":"2024-11-06T04:07:38.817Z","updated_at":"2025-04-07T12:32:06.652Z","avatar_url":"https://github.com/syntifi.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Java CI](https://github.com/syntifi/casper-sdk/actions/workflows/gradle.yml/badge.svg)](https://github.com/syntifi/casper-sdk/actions/workflows/gradle.yml)\n![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/syntifi/casper-sdk?sort=semver)\n[![Project license](https://img.shields.io/badge/license-Apache%202-blue)](https://www.apache.org/licenses/LICENSE-2.0.txt)\n\n# Casper Java SDK\n \nThis project implements the SDK to interact with a Casper Node. It wraps the Json-RPC requests and maps the results to Java objects. \n\n## Dependencies\n- Java 8 \n- Gradle\n- [crypto-keys](https://github.com/syntifi/crypto-keys)\n\n## Build instructions\n```\n./gradlew build\n```\n\n## Including the library\n\nUsing gradle:\n\n```gradle\nimplementation 'com.syntifi.casper:casper-sdk:0.2.1'\n```\n\nUsing maven:\n\n``` xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.syntifi.casper\u003c/groupId\u003e\n  \u003cartifactId\u003ecasper-sdk\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## How to\n\n### 1. [Set-up a connection](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/AbstractJsonRpcTests.java#L23-L39)\n\n```Java\ncasperService = CasperService.usingPeer(\"127.0.0.1\",\"7777\");\n```\n\n### 2. Query a block\nRetrieve block info by a block identifier\n\n#### [Last block](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L119)\n```Java\nJsonBlockData result = casperService.getBlock();\n```\n#### [By height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L138-L139)\n```Java\nJsonBlockData result = casperService.getBlock(new HeightBlockIdentifier(1234));\n```\n#### [By hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L126-L127)\n```Java\nJsonBlockData blockData = casperService.getBlock(new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 3. Query transfers\nRetrieve block transfers by a block identifier\n\n#### [Last block](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L148)\n```Java\nTransferData transferData = casperService.getBlockTransfers();\n```\n#### [By block height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L155)\n```Java\nTransferData transferData = casperService.getBlockTransfers(new HeightBlockIdentifier(1234));\n```\n#### [By block hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L170-L171)\n```Java\nTransferData transferData = casperService.getBlockTransfers(new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 3. Query state root hash\nRetrieve the state root hash given the BlockIdentifier\n#### [Last block](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L186)\n```Java\nStateRootHashData stateRootData = casperService.getStateRootHash();\n```\n#### [By block height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L193)\n```Java\nStateRootHashData stateRootData = casperService.getStateRootHash(new HeightBlockIdentifier(1234));\n```\n#### [By block hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L201-L202)\n```Java\nStateRootHashData stateRootData = casperService.getStateRootHash(new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 4. [Query deploy](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L225-L226)\nGet a Deploy from the network\n```Java\nDeployData deployData = casperService.getDeploy(\"--hash--\");\n```\n\n### 5. [Query peers](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L111)\nGet network peers data\n```Java\nPeerData peerData = casperService.getPeerData();\n```\n\n### 6. [Query stored value](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L212-L215)\nRetrieve a stored value from the network\n```Java\nStoredValueData result = casperService.getStateItem(\"--stateRootHash--\", \"key\", Arrays.asList(\"The path components starting from the key as base\"));\n```\n\n### 7. [Get node status](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L242)\nReturn the current status of the node\n```Java\nStatusData status = casperService.getStatus()\n```\n\n### 8. Get account info\nReturns an Account from the network\n#### [By block height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L280-L282)\n```Java\nAccountData account = casperService.getStateAccountInfo(\"--publicKey--\", new HeightBlockIdentifier(1234));\n```\n#### [By block hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L268-L270)\n```Java\nAccountData account = casperService.getStateAccountInfo(\"--publicKey--\", new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 9. Get auction info\nReturns the Auction info for a given block\n#### [By block height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L302)\n```Java\nAuctionData auction = casperService.getStateAuctionInfo(new HeightBlockIdentifier(1234));\n```\n#### [By block hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L292-L293)\n```Java\nAuctionData auction = casperServiceMainnet.getStateAuctionInfo(new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 10. Get era info\nReturns an EraInfo from the network\n#### [By block height](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L311)\n```Java\nEraInfoData eraInfoData = casperService.getEraInfoBySwitchBlock(new HeightBlockIdentifier(1234));\n```\n#### [By block hash](https://github.com/syntifi/casper-sdk/blob/main/src/test/java/com/syntifi/casper/sdk/service/CasperServiceTests.java#L325-L326)\n```Java\nEraInfoData eraInfoData = casperService.getEraInfoBySwitchBlock(new HashBlockIdentifier(\"--hash--\"));\n```\n\n### 11. Deploy\n#### [Transfering CSPR ](https://github.com/syntifi/casper-sdk/blob/347e8a8a3538f18a064dc4e224b3d1816b6e8f90/src/test/java/com/syntifi/casper/sdk/service/CasperDeployServiceTests.java#L73-L77)\n\n```Java\nDeploy deploy = CasperDeployService.buildTransferDeploy(from, to,\n    BigInteger.valueOf(2500000000L), \"casper-test\",\n    id, BigInteger.valueOf(100000000L), 1L, ttl, new Date(),\n    new ArrayList\u003c\u003e());\n\nDeployResult deployResult =  casperServiceTestnet.putDeploy(deploy);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntifi%2Fcasper-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntifi%2Fcasper-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntifi%2Fcasper-sdk/lists"}