feat(examples): align example set with Java SDK - #1704
Merged
Dosik13 merged 22 commits intoMay 20, 2026
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 41 |
| Duplication | -22 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
ivostoynovski
force-pushed
the
feat/align-examples-with-java
branch
4 times, most recently
from
May 12, 2026 10:39
15b6751 to
7a8eb1f
Compare
ivostoynovski
marked this pull request as ready for review
May 12, 2026 10:45
Dosik13
reviewed
May 12, 2026
Dosik13
left a comment
Contributor
There was a problem hiding this comment.
it looks okay, maybe I will suggest leaving some of the comments that might be useful for new users and also leave the transaction memos as they are useful
ivostoynovski
added a commit
to ivostoynovski/hiero-sdk-go
that referenced
this pull request
May 12, 2026
…nt-public-key Per PR hiero-ledger#1704 inline review feedback from @Dosik13: keep narrative comments that help new readers, and keep the SetTransactionMemo call (useful for debugging in mirror node explorers). Re-adds: 3-line comment on the account-key chain, the SetTransactionMemo, a one-line comment on SetKey, and a one-line comment before the two Sign() calls. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
Dosik13
reviewed
May 19, 2026
Replaces the previous plain-ED25519 demo with an ECDSA secp256k1 keypair generation + EVM address derivation, matching GenerateKeyExample.java in the Java SDK and generate-key.js in the JS SDK. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Reformats the example to use the verbose step-labeled log style from GenerateKeyWithMnemonicExample.java while keeping the legacy 22-word phrase block as a Go-specific bonus. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Two changes to match ConstructClientExample.java: - Hardcode HEDERA_NETWORK to "testnet" instead of reading from the environment. - Set the operator only on testnetClient instead of on all four clients. Other construction patterns (forName, forNetwork, fromConfigFile) and the SetLedgerID call on the custom client are preserved. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Adds a cleanup-delete at the end of the example to match Java's CreateFileExample, which creates and then deletes the file. Leaves no orphaned files on testnet after running. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Adds before/after balance queries, switches GetReceipt to GetRecord so the memo can be read back, updates the memo string and log lines to match TransferCryptoExample.java. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Sets a default max transaction fee, switches initial balance from zero to 1 hbar, drops the custom transaction ID and memo, switches to PrivateKeyGenerateEd25519, adds a cleanup-delete that returns funds to the operator, and updates log lines to match Java. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Adds an admin key on the topic, switches the topic memo to the Java string, switches GeneratePrivateKey to PrivateKeyGenerateEd25519, publishes 5 messages instead of 3, blocks via a counter+channel up to 60s for all messages to arrive (matches Java's CountDownLatch), adds a cleanup-delete and client.Close, and switches log lines to Java's step-labeled style. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Switches the update memo to Java's exact string, switches GeneratePrivateKey to PrivateKeyGenerateEd25519, adds a cleanup-delete signed with 3 of the new 4 admin keys, adds client.Close, and updates log lines to Java's step-labeled style. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Restructures the example to mirror MultiAppTransferExample: creates an exchange account with SetReceiverSignatureRequired and a user account with a starting balance, queries balances before and after, demonstrates two-party signing via a TransactionFromBytes / Sign / ToBytes round-trip in a separate exchangeSigningService function, and cleans up by deleting both accounts. Adds two log lines around the byte round-trip to make the serialization boundary visible in the output. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Restructures the example to mirror ScheduleMultiSigTransactionExample: - Initial balance 10 hbar -> 2 hbar - Adds SetPayerAccountID and SetAdminKey on the scheduled transaction - Pre-signs the schedule with only privateKey2 (not unsigned) - ScheduleSignTransaction now signs with only privateKey3, not all three keys (the schedule's pedagogical point is progressive multi- party signing — only 2 of 3 ever sign, so the schedule remains pending and the inner transfer never executes) - Adds a ScheduleInfoQuery between the create and the second sign for inspecting signatory state - Adds a cleanup AccountDeleteTransaction signed with all 3 keys - Switches GeneratePrivateKey to PrivateKeyGenerateEd25519 - Drops the SetNodeAccountIDs pinning per cross-SDK alignment - Switches to Java-style step-labeled log lines Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
TopicMessageQuery subscriptions are flaky under CI. Add consensus_pub_sub and consensus_pub_sub_with_submit_key to the run-examples skip list (consensus_pub_sub_chunked was already excluded). Also switch from a long || chain to a case statement for readability. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Brings the chunked-message example into structural parity with the Java reference (operator-sign, bytes round-trip, submit-key sign, mirror subscription). Also adds the large_message.txt fixture used by the example via go:embed. The example currently fails with "Large topic message was not received!" against testnet; the failure is tracked separately in hiero-ledger#1703. The example is already on the run-examples task's skip list, so CI is unaffected. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Java has no equivalent example for FileDeleteTransaction; align with the JS port (hiero-ledger/hiero-sdk-js#4047) instead. Adds top-of-file docblock, step-labeled logging, ECDSA key generation, and explicit client.Close(). Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Mirror of ScheduledTransferExample.java: separate ScheduleCreate (by Alice) from ScheduleSign (by Bob) so the balance-unchanged-while-pending assertion holds. Adds top-of-file docblock, step-labeled logging, ECDSA key for Bob, before/after ScheduleInfoQuery with TransferTransaction type-check, post-sign balance query, and client.Close(). Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Mirror of ScheduleIdenticalTransactionExample.java. Adds top-of-file docblock, step-labeled logging, ECDSA key generation, status enum check (replacing error-string match), full account cleanup, and client.Close() for operator + 3 sub-clients. Uses bare TransactionReceiptQuery.Execute() to read IDENTICAL_SCHEDULE_ALREADY_CREATED receipts without erroring. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
…unt-public-key Client.SetDefaultMaxTransactionFee returns an error; ignoring it tripped errcheck under golangci-lint. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
…complexity Extract appendScheduleSignature and deleteAccountWithKeys helpers to drop main's cyclomatic complexity from 34 to ~24, under the gocyclo threshold of 30. No behavior change. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
…nt-public-key Per PR hiero-ledger#1704 inline review feedback from @Dosik13: keep narrative comments that help new readers, and keep the SetTransactionMemo call (useful for debugging in mirror node explorers). Re-adds: 3-line comment on the account-key chain, the SetTransactionMemo, a one-line comment on SetKey, and a one-line comment before the two Sign() calls. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Replace PrivateKeyGenerateEd25519 with PrivateKeyGenerateEcdsa across the aligned examples, switch the mnemonic example's derivation to ToStandardECDSAsecp256k1PrivateKey, drop the legacy 22-word mnemonic section, and remove the leftover Ed25519 reference from the generate_key docblock. Matches the same migration done in hiero-ledger/hiero-sdk-js#4047. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Per @Dosik13's review on PR hiero-ledger#1704: - construct_client: read HEDERA_NETWORK from env (peer examples already use os.Getenv; drop the introduced const to keep the convention) - delete_file: add the "Example Start!" / "Example Complete!" banner used by sibling examples - consensus_pub_sub_with_submit_key: SetTransactionMemo on topic create - topic_with_admin_key: SetTransactionMemo on topic create - consensus_pub_sub_chunked: SetTransactionMemo on topic create Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
ivostoynovski
force-pushed
the
feat/align-examples-with-java
branch
from
May 20, 2026 06:52
7a00150 to
90052fc
Compare
Revert the Taskfile.yml changes introduced in this PR — the skip-list and run-guard refactoring is out of scope for the examples alignment. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
Dosik13
reviewed
May 20, 2026
… prints Per @Dosik13's review: the transaction transfers HBAR, not tokens. Signed-off-by: ivo <ivo.stoynovski@limechain.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Aligns the Go SDK examples folder with the Java SDK reference so the example set stays structurally consistent across SDKs. Brings 14 existing examples into parity with their Java counterparts (same flow, step labels, signing patterns). Each example is in its own commit for review.
Aligned examples (mirroring Java):
generate-keygenerate-key-with-mnemonicconstruct-clientcreate-filetransfer-cryptoupdate-account-public-keyconsensus-pub-sub-with-submit-keytopic-with-admin-keymulti-app-transferschedule-multi-sig-transactionconsensus-pub-sub-chunked— currently fails when run; tracked in Bug: examples/consensus_pub_sub_chunked fails with "Large topic message was not received!" #1703. Excluded from therun-examplestask so CI is unaffected.scheduled-transferschedule-identical-transactionAligned with JS (Java has no equivalent):
delete-fileRelated
Notes for reviewer
No changes to the SDK itself — examples and the
run-examplestask only.Checklist