Skip to content

Commit 78a0be3

Browse files
Merge remote-tracking branch 'upstream/main' into ci/update-solo-version
2 parents d63c982 + 0c60a4b commit 78a0be3

65 files changed

Lines changed: 4590 additions & 163 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: hiero-client-sdk-linux-medium
3434
steps:
3535
- name: Harden Runner
36-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
36+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
3737
with:
3838
egress-policy: audit
3939

@@ -151,7 +151,7 @@ jobs:
151151
- build
152152
steps:
153153
- name: Harden Runner
154-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
154+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
155155
with:
156156
egress-policy: audit
157157

@@ -225,7 +225,7 @@ jobs:
225225
- build
226226
steps:
227227
- name: Harden Runner
228-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
228+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
229229
with:
230230
egress-policy: audit
231231

@@ -255,8 +255,8 @@ jobs:
255255
installMirrorNode: true
256256
soloVersion: v0.68.0
257257
dualMode: true
258-
hieroVersion: v0.68.0
259-
mirrorNodeVersion: v0.142.0
258+
hieroVersion: v0.73.0
259+
mirrorNodeVersion: v0.153.0
260260

261261
- name: Build SDK
262262
run: ./gradlew assemble
@@ -282,7 +282,7 @@ jobs:
282282
- build
283283
steps:
284284
- name: Harden Runner
285-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
285+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
286286
with:
287287
egress-policy: audit
288288

@@ -337,7 +337,7 @@ jobs:
337337
- build
338338
steps:
339339
- name: Harden Runner
340-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
340+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
341341
with:
342342
egress-policy: audit
343343

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: hiero-client-sdk-linux-medium
2626
steps:
2727
- name: Harden Runner
28-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
28+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
2929
with:
3030
egress-policy: audit
3131

.github/workflows/release-artifacts.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: hiero-client-sdk-linux-medium
3232
steps:
3333
- name: Harden Runner
34-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
34+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
3535
with:
3636
egress-policy: audit
3737

@@ -81,7 +81,7 @@ jobs:
8181

8282
steps:
8383
- name: Harden Runner
84-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
84+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
8585
with:
8686
egress-policy: audit
8787

.github/workflows/snyk-monitor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: hiero-client-sdk-linux-medium
1818
steps:
1919
- name: Harden Runner
20-
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
20+
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
2121
with:
2222
egress-policy: audit
2323

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 2.72.0
9+
10+
### Added
11+
12+
- feat: HIP-1137 (#2654)
13+
814
## 2.71.0
915

1016
### Added

docs/android-app/android-app-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ To get started with an Android project, you'll need to add the following **two**
77
1. **Hedera™ Java SDK:**
88

99
```groovy
10-
implementation 'com.hedera.hashgraph:sdk:2.71.0'
10+
implementation 'com.hedera.hashgraph:sdk:2.72.0'
1111
```
1212

1313
2. **gRPC implementation:**

docs/java-app/java-app-quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To get started with a Java project, you'll need to add the following **three** d
99
_Gradle:_
1010

1111
```groovy
12-
implementation 'com.hedera.hashgraph:sdk:2.71.0'
12+
implementation 'com.hedera.hashgraph:sdk:2.72.0'
1313
```
1414

1515
_Maven:_
@@ -18,7 +18,7 @@ _Maven:_
1818
<dependency>
1919
<groupId>com.hedera.hashgraph</groupId>
2020
<artifactId>sdk</artifactId>
21-
<version>2.71.0</version>
21+
<version>2.72.0</version>
2222
</dependency>
2323
```
2424

example-android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies {
4545
implementation(platform("org.hiero:hiero-dependency-versions"))
4646
// ---------------------------------------------
4747

48-
implementation("com.hedera.hashgraph:sdk:2.71.0")
48+
implementation("com.hedera.hashgraph:sdk:2.72.0")
4949

5050
implementation("com.google.android.material:material:1.12.0")
5151

examples/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ dependencyAnalysis {
1919
dependencies.constraints {
2020
implementation("com.google.guava:guava:33.4.8-android")
2121
implementation("io.github.cdimascio:dotenv-java:3.2.0")
22-
implementation("com.hedera.hashgraph:sdk:2.71.0")
23-
implementation("com.hedera.hashgraph:sdk-full:2.71.0")
22+
implementation("com.hedera.hashgraph:sdk:2.72.0")
23+
implementation("com.hedera.hashgraph:sdk-full:2.72.0")
2424
implementation("com.google.code.findbugs:jsr305:3.0.2")
2525
}
2626

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
package com.hedera.hashgraph.sdk.examples;
3+
4+
import com.hedera.hashgraph.sdk.AccountId;
5+
import com.hedera.hashgraph.sdk.BlockNodeApi;
6+
import com.hedera.hashgraph.sdk.BlockNodeServiceEndpoint;
7+
import com.hedera.hashgraph.sdk.Client;
8+
import com.hedera.hashgraph.sdk.NodeUpdateTransaction;
9+
import com.hedera.hashgraph.sdk.PrivateKey;
10+
import com.hedera.hashgraph.sdk.RegisteredNode;
11+
import com.hedera.hashgraph.sdk.RegisteredNodeAddressBook;
12+
import com.hedera.hashgraph.sdk.RegisteredNodeAddressBookQuery;
13+
import com.hedera.hashgraph.sdk.RegisteredNodeCreateTransaction;
14+
import com.hedera.hashgraph.sdk.RegisteredNodeDeleteTransaction;
15+
import com.hedera.hashgraph.sdk.RegisteredNodeUpdateTransaction;
16+
import com.hedera.hashgraph.sdk.TransactionReceipt;
17+
import com.hedera.hashgraph.sdk.TransactionResponse;
18+
import com.hedera.hashgraph.sdk.logger.LogLevel;
19+
import com.hedera.hashgraph.sdk.logger.Logger;
20+
import io.github.cdimascio.dotenv.Dotenv;
21+
import java.util.List;
22+
import java.util.Objects;
23+
24+
public class RegisteredNodeLifeCycleExample {
25+
/*
26+
* See .env.sample in the examples folder root for how to specify values below
27+
* or set environment variables with the same names.
28+
*/
29+
30+
/**
31+
* Operator's account ID.
32+
* Used to sign and pay for operations on Hedera.
33+
*/
34+
private static final AccountId OPERATOR_ID =
35+
AccountId.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_ID")));
36+
37+
/**
38+
* Operator's private key.
39+
*/
40+
private static final PrivateKey OPERATOR_KEY =
41+
PrivateKey.fromString(Objects.requireNonNull(Dotenv.load().get("OPERATOR_KEY")));
42+
43+
/**
44+
* HEDERA_NETWORK defaults to testnet if not specified in dotenv file.
45+
* Network can be: localhost, testnet, previewnet or mainnet.
46+
*/
47+
private static final String HEDERA_NETWORK = Dotenv.load().get("HEDERA_NETWORK", "testnet");
48+
49+
/**
50+
* SDK_LOG_LEVEL defaults to SILENT if not specified in dotenv file.
51+
* Log levels can be: TRACE, DEBUG, INFO, WARN, ERROR, SILENT.
52+
* <p>
53+
* Important pre-requisite: set simple logger log level to same level as the SDK_LOG_LEVEL,
54+
* for example via VM options: -Dorg.slf4j.simpleLogger.log.org.hiero=trace
55+
*/
56+
private static final String SDK_LOG_LEVEL = Dotenv.load().get("SDK_LOG_LEVEL", "SILENT");
57+
58+
public static void main(String[] args) throws Exception {
59+
System.out.println("Registered Node Lifecycle Example Start!");
60+
61+
/*
62+
* Step 0:
63+
* Create and configure the SDK Client.
64+
*/
65+
Client client = ClientHelper.forName(HEDERA_NETWORK);
66+
// All generated transactions will be paid by this account and signed by this key.
67+
client.setOperator(OPERATOR_ID, OPERATOR_KEY);
68+
// Attach logger to the SDK Client.
69+
client.setLogger(new Logger(LogLevel.valueOf(SDK_LOG_LEVEL)));
70+
71+
/*
72+
* Step 1:
73+
* Generate an admin key pair and configure a BlockNodeServiceEndpoint
74+
* for use in the RegisterNodeTransaction.
75+
*/
76+
PrivateKey adminKey = PrivateKey.generateED25519();
77+
BlockNodeServiceEndpoint initialEndpoint = new BlockNodeServiceEndpoint()
78+
.setIpAddress(new byte[] {127, 0, 0, 1})
79+
.setPort(443)
80+
.setRequiresTls(true)
81+
.setEndpointApis(List.of(BlockNodeApi.SUBSCRIBE_STREAM, BlockNodeApi.STATUS));
82+
83+
/*
84+
* Step 2:
85+
* Create Registered Node.
86+
*/
87+
RegisteredNodeCreateTransaction registeredNodeCreateTx = new RegisteredNodeCreateTransaction()
88+
.setDescription("My Block Node")
89+
.setAdminKey(adminKey)
90+
.addServiceEndpoint(initialEndpoint)
91+
.freezeWith(client)
92+
.sign(adminKey);
93+
94+
System.out.println("Creating Registered Node...");
95+
TransactionResponse registeredNodeCreateTxResponse = registeredNodeCreateTx.execute(client);
96+
TransactionReceipt registeredNodeCreateTxReceipt = registeredNodeCreateTxResponse.getReceipt(client);
97+
98+
if (registeredNodeCreateTxReceipt.registeredNodeId <= 0) {
99+
throw new Exception("RegisteredNodeCreate transaction receipt was missing registeredNodeId. (Fail)");
100+
}
101+
102+
long registeredNodeId = registeredNodeCreateTxReceipt.registeredNodeId;
103+
104+
/*
105+
* Step 3:
106+
* Execute a RegisteredNodeAddressBookQuery to verify the newly created
107+
* registered node appears in the RegisteredNodeAddressBook.
108+
*/
109+
110+
// Wait for mirror node to update
111+
Thread.sleep(5000);
112+
RegisteredNodeAddressBookQuery addressBookQuery =
113+
new RegisteredNodeAddressBookQuery().setRegisteredNodeId(registeredNodeId);
114+
115+
System.out.println("Executing RegisteredNodeQuery....");
116+
RegisteredNodeAddressBook addressBook = addressBookQuery.execute(client);
117+
RegisteredNode registeredNode = addressBook.registeredNodes.getFirst();
118+
119+
System.out.println("Successfully fetch the registered node, " + registeredNode);
120+
121+
/*
122+
* Step 4:
123+
* Update the RegisteredNode with new Block Node endpoint.
124+
*/
125+
BlockNodeServiceEndpoint updateEndpoint = new BlockNodeServiceEndpoint()
126+
.setDomainName("block-node.example.com")
127+
.setPort(443)
128+
.setRequiresTls(true)
129+
.addEndpointApi(BlockNodeApi.STATUS);
130+
131+
RegisteredNodeUpdateTransaction registeredNodeUpdateTx = new RegisteredNodeUpdateTransaction()
132+
.setRegisteredNodeId(registeredNodeId)
133+
.setDescription("My Updated Block Node")
134+
.setServiceEndpoints(List.of(initialEndpoint, updateEndpoint))
135+
.freezeWith(client)
136+
.sign(adminKey);
137+
138+
System.out.println("Updating Registered Node...");
139+
TransactionResponse registeredNodeUpdateTxResponse = registeredNodeUpdateTx.execute(client);
140+
registeredNodeUpdateTxResponse.getReceipt(client);
141+
142+
/*
143+
* Step 5:
144+
* Add the registeredNodeId as associatedRegisteredNodes to a Node.
145+
* NOTE: This transaction must be signed by the consensus node's admin key.
146+
* In this example, we assume the operator is the node admin.
147+
*/
148+
149+
NodeUpdateTransaction associateTx = new NodeUpdateTransaction()
150+
.setNodeId(0)
151+
.addAssociatedRegisteredNode(registeredNodeId)
152+
.freezeWith(client);
153+
154+
System.out.println("Associating registered node " + registeredNodeId + " with consensus node...");
155+
TransactionResponse associateTxResponse = associateTx.execute(client);
156+
associateTxResponse.getReceipt(client);
157+
158+
/*
159+
* Step 6:
160+
* Remove the registeredNodeId as associatedRegisteredNodes from a Node.
161+
*/
162+
163+
NodeUpdateTransaction disassociateTx = new NodeUpdateTransaction()
164+
.setNodeId(0)
165+
.clearAssociatedRegisteredNodes() // Empty list to clear associated registeredNode
166+
.freezeWith(client);
167+
168+
System.out.println("Disassociating registered node " + registeredNodeId + " with consensus node...");
169+
TransactionResponse disassociatedTxResponse = disassociateTx.execute(client);
170+
disassociatedTxResponse.getReceipt(client);
171+
172+
/*
173+
* Step 7:
174+
* Delete the Registered Node.
175+
*/
176+
System.out.println("Deleting Registered Node...");
177+
new RegisteredNodeDeleteTransaction()
178+
.setRegisteredNodeId(registeredNodeCreateTxReceipt.registeredNodeId)
179+
.freezeWith(client)
180+
.sign(adminKey)
181+
.execute(client)
182+
.getReceipt(client);
183+
184+
client.close();
185+
186+
System.out.println("Registered Node Lifecycle Example Complete!");
187+
}
188+
}

0 commit comments

Comments
 (0)