Skip to content

[Good First Issue]: Add top level explanation to src/sdk/examples/AccountAllowanceSerializedExample.cpp #1197

@exploreriii

Description

@exploreriii

🆕🐥 First-Time Friendly

This issue is especially welcoming for people who are new to contributing to the Hiero C++ SDK.

We know that opening your first pull request can feel like a big step.
Issues labeled Good First Issue are designed to make that experience easier, clearer, and more comfortable.

No prior knowledge of Hiero, Hedera, or distributed ledger technology is required.
Just a basic familiarity with C++ and Git is more than enough to get started.

👾 Description of the Issue

We have an example src/sdk/examples/AccountAllowanceSerializedExample.cpp which has comments using

//

but it lacks an explanation at the top of the file what the example demonstrates.

src/sdk/examples/AccountAliasExample.cpp is a similar example, which does have a top level explanation, for example:

/**
 * This example demonstrates Hiero's alias-based automatic account creation.
 *
 * An alias is an AccountId derived from a public key. 
 * It can be used in transactions before the account exists on-ledger.
 *
 * Essential steps:
 * - Load an operator account to sign and pay for transactions.
 * - Generate a key pair locally.
 * - Derive an alias AccountId from the public key.
 * - Transfer HBAR to the alias, which creates the account on-ledger.
 *
 * Optional steps (for illustration purposes):
 * - Query the account balance.
 * - Query account info to obtain the permanent numeric AccountId.
 *
 * No explicit CreateAccount transaction is used. 
 * Funding the alias both creates and initializes the account, which can then be referenced by
 * either its alias (public key) or numeric AccountId.
 */

We could provide a similar top level explanation for src/sdk/examples/AccountAllowanceSerializedExample.cpp

💡 Proposed Solution

Add a top level explanation to src/sdk/examples/AccountAllowanceSerializedExample.cpp similar to src/sdk/examples/AccountAliasExample.cpp

👩‍💻 Implementation Steps (End-to-End)

Add a top level explanation to src/sdk/examples/AccountAllowanceSerializedExample.cpp similar to src/sdk/examples/AccountAliasExample.cpp

To do this, ensure you follow the exact formatting style which is

/**
 * text
 * text
 */

Ensure you are exact!

Follow this structure:

  • what does the example demonstrate at a high level?
  • any key definitions
  • outline the key steps taken in the example
  • outline any steps additionally taken in the example to provide clarity, but perhaps not essential for the transaction
  • any important notes
    but don't make it too long.

You should add this above line 2 and change nothing else in the file.

here is an idea for guidance only - please edit this, check it and improve it:

/**
 * This example demonstrates how Hiero transactions can be serialized, deserialized,
 * inspected, signed, and executed using WrappedTransaction — alongside Hbar allowance usage.
 *
 * It extends the standard allowance flow by showing how transactions can be converted
 * to raw bytes and reconstructed before execution.
 *
 * Essential steps:
 * - Load an operator account to pay for transactions.
 * - Generate accounts for Alice (owner), Bob (spender), and Charlie (receiver).
 * - Alice approves Bob to spend a fixed amount of her Hbar.
 * - Construct an approved transfer transaction using Bob’s allowance.
 * - Serialize the transaction into bytes.
 * - Deserialize the transaction using WrappedTransaction.
 * - Freeze, sign, and execute the reconstructed transaction.
 *
 * Optional steps (for illustration purposes):
 * - Inspect serialized transaction byte data.
 * - Print transaction type and selected fields after deserialization.
 * - Demonstrate allowance enforcement through a failed transfer.
 * - Update the allowance and execute another transfer.
 * - Show how freezing affects transaction bytes.
 * - Inspect transaction fields after signing.
 * - Query balances and display transaction statuses.
 * - Delete created accounts after completion.
 *
 * This example highlights how transactions can be transported or stored
 * as raw bytes, reconstructed later, and still maintain correctness
 * through freezing and signing prior to execution.
 */

✅ Acceptance Criteria

To merge a pull request for this issue:

  • Scope: Changes are limited to this issue
  • Behavior: No SDK behavior or public API changes
  • Tests: Existing CI checks pass
  • Review: All code review feedback addressed

📋 Step-by-Step Contribution Guide

To help your first contribution go as smoothly as possible, we recommend following these steps:

  • Comment /assign to request the issue
  • Wait for assignment
  • Fork the repository and create a branch
  • Set up the project by following the instructions in README.md
  • Make the requested changes
  • Sign each commit using -s -S
  • Push your branch and open a pull request

Read Workflow Guide for step-by-step workflow guidance.
Read README.md for setup instructions.

❗ Pull requests cannot be merged without S and s signed commits.
See the Signing Guide.

🤔 Additional Information

If you need help, reach out to the @hiero-ledger/hiero-sdk-good-first-issue-support team.

You can also join our community on Discord:
Hiero-SDK-C++

Maintainers are happy to help first-time contributors succeed!

Metadata

Metadata

Assignees

Labels

kind: documentationImprovements or additions to READMEs, guides, API docs, or code commentspriority: lowNon-urgent tasks, nice-to-have improvements, or minor issuesscope: examplesRelated to example projects or snippetsskill: good first issueSimple, well-scoped tasks ideal for someone new to the repository or open source

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions