Skip to content

Commit 4a9b39e

Browse files
Revise README for project relocation and updates
Updated project information and removed outdated content.
1 parent 0667cd0 commit 4a9b39e

File tree

1 file changed

+1
-211
lines changed

1 file changed

+1
-211
lines changed

README.md

Lines changed: 1 addition & 211 deletions
Original file line numberDiff line numberDiff line change
@@ -1,214 +1,4 @@
11
# Hiero Enterprise Java
22

3-
This project provides Java modules to interact with a [Hiero network](https://hiero.org) in a Java Enterprise application.
4-
The project provides integrations to Spring Boot or Eclipse Microprofile (like Quarkus) for interacting with Hiero.
5-
This module is based on the [Hedera Java SDK](https://github.com/hashgraph/hedera-sdk-java)(will be migrated to Hiero Java SDK in near future) and provides a set of managed services to interact with a Hiero network.
3+
This project has been moved to https://github.com/hiero-ledger/hiero-enterprise-java
64

7-
> [!NOTE]
8-
> The repo is currently transformed to be compatible with the vendor neutral [Hiero](hiero.org) project.
9-
> Hedera is 100% compatible with Hiero and the transformation is just a renaming of the packages, classes, documentation, and so on.
10-
> The transformation is still in progress and not all is renamed yet.
11-
12-
## Spring Boot support
13-
14-
To use this module, you need to add the following dependency to your project:
15-
16-
```xml
17-
<dependency>
18-
<groupId>com.open-elements.hiero</groupId>
19-
<artifactId>hiero-enterprise-spring</artifactId>
20-
<version>VERSION</version>
21-
</dependency>
22-
```
23-
24-
### Configuration
25-
26-
To configure the module, you need to add the following properties to your application.properties file:
27-
28-
```properties
29-
spring.hiero.accountId=0.0.53854625
30-
spring.hiero.privateKey=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
31-
spring.hiero.network=hedera-testnet
32-
```
33-
34-
The `spring.hiero.network` property defines the network that is used to interact with the Hiero network.
35-
In the given example, the [Hedera](https://hedera.com) testnet network is used.
36-
Hedera is based on Hiero and therefore the testnet can be used to interact with a Hiero network.
37-
The account information (`accountId`, `privateKey`) can all be found at the [Hedera portal](https://portal.hedera.com/) for a testnet or previewnet account.
38-
Today only the "DER Encoded Private Key" of the "ECDSA" key type is supported for the `spring.hiero.privateKey` property.
39-
40-
The 2 properties `spring.hiero.accountId` and `spring.hiero.privateKey` define the "operator account".
41-
The operator account is used as the account that sends all transactions against the Hiero network.
42-
43-
### Usage
44-
45-
To use the module, you need to add the `@EnableHiero` annotation to your Spring Boot application class.
46-
47-
```java
48-
import com.open.elements.spring.hiero.EnableHiero;
49-
50-
@SpringBootApplication
51-
@EnableHiero
52-
public class Application {
53-
public static void main(String[] args) {
54-
SpringApplication.run(Application.class, args);
55-
}
56-
}
57-
```
58-
59-
Once that is done you can for example autowire the `FileClient` class and call the methods to interact with a Hiero network.
60-
61-
```java
62-
63-
@Service
64-
public class HieroAccountService {
65-
66-
@Autowired
67-
private FileClient fileClient;
68-
69-
public String readFile(String id) {
70-
FileId fileId = FileId.of(id);
71-
byte[] content = fileClient.readFile(fileId);
72-
return new String(content);
73-
}
74-
}
75-
```
76-
77-
All APIs of the client are synchronous and return the result of the operation.
78-
For asynchronous operations, you can easily wrap calls by use the [`@Async` annotation of spring](https://spring.io/guides/gs/async-method).
79-
80-
### Hiero Spring Sample
81-
82-
A sample application that uses the Hiero Spring module can be found in the `hiero-enterprise-spring-sample` module.
83-
The sample application is a simple Spring Boot application that reads has a REST endpoint at `localhost:8080/` and shows the hbar balance of the account `0.0.100` on the Hedera testnet.
84-
To use the application, you need to have created a Hedera testnet account at the [Hedera portal](https://portal.hedera.com/).
85-
The account information can be added to the `application.properties` file in the `hedera-spring-sample` module:
86-
```properties
87-
spring.hiero.accountId=0.0.3447271
88-
spring.hiero.privateKey=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
89-
```
90-
91-
The module supports a `.env` file in the root of the module to define the account information.
92-
The file is added to the `.gitignore` file and is not committed to the repository.
93-
By doing that you can define the account information in the `.env` file without the risk of committing it to the repository.
94-
The `.env` file should look like this:
95-
```properties
96-
spring.hiero.accountId=0.0.3447271
97-
spring.hiero.privateKey=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
98-
```
99-
100-
Alternatively, you can provide the account information as environment variables:
101-
```shell
102-
export HEDERA_ACCOUNT_ID=0.0.3447271
103-
export HEDERA_PRIVATE_KEY=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
104-
```
105-
106-
An external sample project can be found at https://github.com/hendrikebbers/spring-hiero-sample
107-
108-
## Microservice support
109-
110-
To use this module, you need to add the following dependency to your project:
111-
112-
```xml
113-
<dependency>
114-
<groupId>com.open-elements.hiero</groupId>
115-
<artifactId>hiero-enterprise-microprofile</artifactId>
116-
<version>VERSION</version>
117-
</dependency>
118-
```
119-
120-
The `hiero-enterprise-microprofile-sample` module contains a sample application that uses the Hiero Microprofile module.
121-
The sample application is a simple Quarkus application that reads has a REST endpoint at `localhost:8080/` and shows
122-
the hbar balance of the account `0.0.100` on the Hedera testnet.
123-
For most of the part, the sample application is the same as the Spring Boot sample application.
124-
125-
A sample project can be found at https://github.com/hendrikebbers/quarkus-hiero-sample
126-
127-
## Managed services
128-
129-
The module provides a set of managed services that can be used to interact with a Hiero network.
130-
The following services are available in spring and microprofile:
131-
132-
- `com.openelements.hiero.base.HieroContext`: component that provides the information about the Hiero network and the operator account
133-
- `com.openelements.hiero.base.AccountClient`: to interact with accounts
134-
- `com.openelements.hiero.base.FileClient`: to interact with files
135-
- `com.openelements.hiero.base.FungibleTokenClient`: to interact with fungible tokens
136-
- `com.openelements.hiero.base.NftClient`: to interact with NFTs
137-
- `com.openelements.hiero.base.SmartContractClient`: to interact with smart contracts
138-
- `com.openelements.hiero.base.verifcation.ContractVerificationClient`: to verify smart contracts
139-
- `com.openelements.hiero.base.mirrornode.AccountRepository`: to query accounts
140-
- `com.openelements.hiero.base.mirrornode.NetworkRepository`: to query network information
141-
- `com.openelements.hiero.base.mirrornode.NftRepository`: to query NFTs
142-
- `com.openelements.hiero.base.mirrornode.TransactionRepository`: to query transaction information
143-
144-
Next to that the following low-level services are available:
145-
146-
- `com.openelements.hiero.base.protocol.ProtocolLayerClient`: to interact with the Hiero protocol layer
147-
- `com.openelements.hiero.base.mirrornode.MirrorNodeClient`: to query the Hiero mirror node
148-
149-
## Built the project
150-
151-
The project is based on [Maven](https://maven.apache.org/).
152-
To build the project, you can use the following command:
153-
154-
```shell
155-
./mvnw verify
156-
```
157-
158-
The tests in the project are working against any Hiero network.
159-
You need to provide the account id and the private key of an account that is used to run the tests.
160-
**If no account is provided, the tests will fail.**
161-
The most easy way to run the tests is to use the Hedera testnet network.
162-
To run the tests, you need to provide the account id and the "DER Encoded Private Key" of the "ECDSA" testnet account.
163-
That information can be provided as environemt variables:
164-
165-
```shell
166-
export HEDERA_ACCOUNT_ID=0.0.3447271
167-
export HEDERA_PRIVATE_KEY=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
168-
export HEDERA_NETWORK=testnet
169-
```
170-
171-
As an alternative you can define the information in a `.env` file in each sub-module that contains tests.
172-
The files are added to the `.gitignore` file and will not be committed to the repository.
173-
The file should look like this:
174-
175-
```
176-
spring.hiero.accountId=0.0.3447271
177-
spring.hiero.privateKey=2130020100312346052b8104400304220420c236508c429395a8180b1230f436d389adc5afaa9145456783b57b2045c6cc37
178-
```
179-
180-
### Create a release
181-
182-
The project is using the [JReleaser](https://jreleaser.org) Maven plugin to create and publish releases.
183-
To use the plugin, you need to provide the following environment variables:
184-
185-
```
186-
JRELEASER_GITHUB_TOKEN=your_secret_github_token
187-
JRELEASER_GPG_SECRET_KEY=your_secret_key
188-
JRELEASER_GPG_PASSPHRASE=your_secret_passphrase
189-
JRELEASER_GPG_PUBLIC_KEY=yout_public_key
190-
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME=your_maven_central_username
191-
JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN=your_secret_maven_central_token
192-
```
193-
194-
How that environment variables are defined can be found in the
195-
[JReleaser documentation](https://jreleaser.org/guide/latest/examples/maven/maven-central.html) and
196-
[this blog post](https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/).
197-
198-
On a unix based system the environment variables can be defined in the `.env` file in the root of the project.
199-
The file is added to the `.gitignore` file and is not committed to the repository.
200-
201-
Once that is done you can use the `release.sh` script in the root folder of the repos to create a release:
202-
203-
```shell
204-
./release 0.1.0 0.2.0-SNAPSHOT
205-
```
206-
207-
This will create a release on GitHub and publish the artifacts to Maven Central.
208-
As you can see 2 params are passed to the `release.sh` script, The first param defines the version for the release and the second param defines the version after the release.
209-
In the given example the project has defined version 0.1.0-SNAPSHOT before the script is executed.
210-
The execution will release the current code under version 0.1.0 and later switch the version to 0.2.0-SNAPSHOT and commit it.
211-
212-
## License
213-
214-
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)