{"id":15014917,"url":"https://github.com/hyperledger/fabric-gateway-java","last_synced_at":"2025-04-14T15:46:51.387Z","repository":{"id":35415364,"uuid":"174452370","full_name":"hyperledger/fabric-gateway-java","owner":"hyperledger","description":"Hyperledger Fabric Gateway SDK for Java https://wiki.hyperledger.org/display/fabric","archived":false,"fork":false,"pushed_at":"2024-10-12T10:16:54.000Z","size":3859,"stargazers_count":211,"open_issues_count":0,"forks_count":115,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-07T04:15:51.266Z","etag":null,"topics":["blockchain","distributed-ledger","fabric","hyperledger","java"],"latest_commit_sha":null,"homepage":"https://hyperledger.github.io/fabric-gateway-java/","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/hyperledger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-08T02:07:22.000Z","updated_at":"2025-04-03T16:49:11.000Z","dependencies_parsed_at":"2024-01-15T17:23:01.756Z","dependency_job_id":"5f8b8afe-700d-4434-a023-0e3919a149bc","html_url":"https://github.com/hyperledger/fabric-gateway-java","commit_stats":{"total_commits":161,"total_committers":17,"mean_commits":9.470588235294118,"dds":0.670807453416149,"last_synced_commit":"259f00ca6d140064557c9cc40932769e6087430e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger%2Ffabric-gateway-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger%2Ffabric-gateway-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger%2Ffabric-gateway-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperledger%2Ffabric-gateway-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperledger","download_url":"https://codeload.github.com/hyperledger/fabric-gateway-java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248908643,"owners_count":21181570,"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":["blockchain","distributed-ledger","fabric","hyperledger","java"],"created_at":"2024-09-24T19:46:16.255Z","updated_at":"2025-04-14T15:46:51.366Z","avatar_url":"https://github.com/hyperledger.png","language":"Java","readme":"# Hyperledger Fabric Gateway SDK for Java \u003ca href=\"https://github.com/hyperledger/fabric-gateway-java/actions/workflows/schedule.yml\"\u003e\u003cimg src=\"https://github.com/hyperledger/fabric-gateway-java/actions/workflows/schedule.yml/badge.svg\" alt=\"Build status\" style=\"float: right\"\u003e\u003c/a\u003e\n\n\u003e **Note:** This API is deprecated as of Fabric v2.5. When developing applications for Hyperledger Fabric v2.4 and later, you should use the [Fabric Gateway client API](https://hyperledger.github.io/fabric-gateway/).\n\nThe Fabric Gateway SDK allows applications to interact with a Fabric blockchain network.  It provides a simple API to submit transactions to a ledger or query the contents of a ledger with minimal code.\n\nThe Gateway SDK implements the Fabric programming model as described in the [Developing Applications](https://hyperledger-fabric.readthedocs.io/en/latest/developapps/developing_applications.html) chapter of the Fabric documentation.\n\n## How to use \n\nThe following shows a complete code sample of how to connect to a fabric network, submit a transaction and query the ledger state using an instantiated smart contract (fabcar sample).\n\n```java\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.concurrent.TimeoutException;\n\nimport org.hyperledger.fabric.gateway.Contract;\nimport org.hyperledger.fabric.gateway.ContractException;\nimport org.hyperledger.fabric.gateway.Gateway;\nimport org.hyperledger.fabric.gateway.Network;\nimport org.hyperledger.fabric.gateway.Wallet;\nimport org.hyperledger.fabric.gateway.Wallets;\n\nclass Sample {\n    public static void main(String[] args) throws IOException {\n        // Load an existing wallet holding identities used to access the network.\n        Path walletDirectory = Paths.get(\"wallet\");\n        Wallet wallet = Wallets.newFileSystemWallet(walletDirectory);\n\n        // Path to a common connection profile describing the network.\n        Path networkConfigFile = Paths.get(\"connection.json\");\n\n        // Configure the gateway connection used to access the network.\n        Gateway.Builder builder = Gateway.createBuilder()\n                .identity(wallet, \"user1\")\n                .networkConfig(networkConfigFile);\n\n        // Create a gateway connection\n        try (Gateway gateway = builder.connect()) {\n\n            // Obtain a smart contract deployed on the network.\n            Network network = gateway.getNetwork(\"mychannel\");\n            Contract contract = network.getContract(\"fabcar\");\n\n            // Submit transactions that store state to the ledger.\n            byte[] createCarResult = contract.createTransaction(\"createCar\")\n                    .submit(\"CAR10\", \"VW\", \"Polo\", \"Grey\", \"Mary\");\n            System.out.println(new String(createCarResult, StandardCharsets.UTF_8));\n\n            // Evaluate transactions that query state from the ledger.\n            byte[] queryAllCarsResult = contract.evaluateTransaction(\"queryAllCars\");\n            System.out.println(new String(queryAllCarsResult, StandardCharsets.UTF_8));\n\n        } catch (ContractException | TimeoutException | InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n```\n\n### API documentation\n\nFull Javadoc documentation is published for each of the following versions:\n- [2.2](https://hyperledger.github.io/fabric-gateway-java/main/)\n- [1.4](https://hyperledger.github.io/fabric-gateway-java/release-1.4/)\n\n### Maven\n\nAdd the following dependency to your project's `pom.xml` file:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.hyperledger.fabric\u003c/groupId\u003e\n  \u003cartifactId\u003efabric-gateway-java\u003c/artifactId\u003e\n  \u003cversion\u003e2.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\nAdd the following dependency to your project's `build.gradle` file:\n\n```groovy\nimplementation 'org.hyperledger.fabric:fabric-gateway-java:2.2.0'\n```\n\n### Compatibility\n\nThe following table shows versions of Fabric, Java and other dependencies that are explicitly tested and that are supported for use with version 2.2 of the Fabric Gateway SDK. Refer to the appropriate GitHub branch for compatibility of other release versions.\n\n| | Tested | Supported |\n| --- | --- | --- |\n| **Fabric** | 2.2 | 2.2 |\n| **Java** | 8, 11, 17 | 8+ |\n| **Platform** | Ubuntu 22.04 | |\n\n#### Client applications running on POWER architecture\nTo run Java SDK clients on IBM POWER systems (e.g. zLinux), use Java 11 and set the SSL provider to ‘JDK’ by either supplying the -D command line option:\n\n```-Dorg.hyperledger.fabric.sdk.connections.ssl.sslProvider=JDK```\n\nor with the environment variable set as follows:\n\n```ORG_HYPERLEDGER_FABRIC_SDK_CONNECTIONS_SSL_SSLPROVIDER=JDK```\n\n## Building and testing\n\n```commandline\ngit clone https://github.com/hyperledger/fabric-gateway-java.git\ncd fabric-gateway-java\nmvn install\n```\n\nThe `mvn install` command will download the dependencies and run all the unit tests and scenario tests. It will also generate all the crypto material required by these tests.\n\nDocker is required to run the scenario tests.\n\n### Unit tests\n\nAll classes and methods have a high coverage (~90%) of unit tests. These are written using the [JUnit](https://junit.org/junit5/),\n[AssertJ](https://joel-costigliola.github.io/assertj/) and [Mockito](https://site.mockito.org/) frameworks.\n\n### Scenario tests\n\nScenario tests are written using the [Cucumber](https://cucumber.io/) BDD framework.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperledger%2Ffabric-gateway-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperledger%2Ffabric-gateway-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperledger%2Ffabric-gateway-java/lists"}