hiero-ledger / hiero-ledger/hiero-sdk-cpp
[Intermediate]: Add HIP-869 Dynamic Address Book Example
- Dominant language
- C++
- Stars
- 42
- Forks
- 108
- Avg merge
- 11h 45m
- Merged PRs (30d)
- 2
Description
## 🧩 Intermediate Friendly
This issue is a good fit for contributors who are already familiar with the Hiero C++ SDK and feel comfortable navigating the codebase.
Intermediate Issues often involve:
- Exploring existing implementations
- Understanding how different components work together
- Making thoughtful changes that follow established patterns
The goal is to support deeper problem-solving while keeping the task clear, focused, and enjoyable to work on.
---
## 🐞 Problem Description
The Hiero C++ SDK implements the HIP-869 Dynamic Address Book transactions but lacks an example demonstrating their usage:
- `NodeCreateTransaction` - Add a new consensus node to the network
- `NodeUpdateTransaction` - Update an existing node's properties
- `NodeDeleteTransaction` - Remove a node from the network
These transactions are already implemented in the SDK but developers have no reference for how to construct and configure them.
Relevant files:
- `src/sdk/main/include/NodeCreateTransaction.h`
- `src/sdk/main/include/NodeUpdateTransaction.h`
- `src/sdk/main/include/NodeDeleteTransaction.h`
---
## 💡 Expected Outcome
Create a new example file `NodeManagementExample.cpp` (or similar) that demonstrates how to construct and configure the HIP-869 node management transactions.
The example should:
- Show how to construct each transaction type with all relevant fields
- Demonstrate setting gossip endpoints, service endpoints, certificates, and admin keys
- Include clear comments explaining the authorization requirements
- Follow existing example patterns in the codebase
**Important considerations:**
- These transactions require special authorization (Council signature and/or admin key)
- The example likely cannot execute successfully on testnet without Council permissions
- The example should clearly document this limitation and focus on demonstrating transaction construction
---
## 🧠 Implementation Notes
**Authorization requirements (from HIP-869):**
| Transaction | Required Signatures |
|-------------|---------------------|
| `NodeCreateTransaction` | Council signature **AND** admin key |
| `NodeUpdateTransaction` | Admin key only |
| `NodeDeleteTransaction` | Admin key **OR** Council signature |
**Suggested approach:**
1. Study existing examples for patterns:
- `src/sdk/examples/CreateAccountExample.cpp`
- `src/sdk/examples/StakingExample.cpp`
2. Review the transaction headers to understand available setters:
- `NodeCreateTransaction`: `setAccountId`, `setDescription`, `setGossipEndpoints`, `setServiceEndpoints`, `setGossipCaCertificate`, `setGrpcCertificateHash`, `setAdminKey`
- `NodeUpdateTransaction`: Same setters plus `setNodeId`
- `NodeDeleteTransaction`: `setNodeId`
3. Create the example demonstrating:
- Transaction construction with typical field values
- Setting endpoints using the `Endpoint` class
- Setting certificates and keys
- Clear comments about what each field represents
4. Document the authorization limitation:
- Add comments explaining that execution requires Council/admin permissions
- Consider wrapping execution in a try-catch to gracefully handle authorization failures
5. Update CMakeLists.txt to include the new example
**Endpoint configuration:**
```cpp
// Gossip endpoints (for node-to-node communication)
std::vector gossipEndpoints;
gossipEndpoints.push_back(Endpoint().setAddress(IPv4Address::fromBytes({192, 168, 1, 1})).setPort(50111));
// Service endpoints (for client gRPC calls)
std::vector serviceEndpoints;
serviceEndpoints.push_back(Endpoint().setAddress(IPv4Address::fromBytes({192, 168, 1, 1})).setPort(50211));
```
---
## ✅ Acceptance Criteria
To help get this change merged smoothly:
- [ ] `NodeManagementExample.cpp` (or similar) created demonstrating all three transaction types
- [ ] Example follows existing project conventions
- [ ] Clear comments explain authorization requirements and limitations
- [ ] Example added to CMakeLists.txt
- [ ] Code compiles without errors
- [ ] Pass all CI checks
---
## 📋 Contribution Guide
To help your 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 using 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](docs/training/workflow.md) for step-by-step workflow guidance.
Read [README.md](README.md) for setup instructions.
❗ Pull requests **cannot be merged** without `S` and `s` signed commits.
See the [Signing Guide](docs/training/signing.md).
---
## 📚 Additional Context or Resources
**References:**
- [HIP-869 Specification](https://hips.hedera.com/hip/hip-869) - Dynamic Address Book Stage 1
- [HIP-1299](https://github.com/hiero-ledger/sdk-collaboration-hub/blob/main/proposals/hips/hip-1299.md) - Node Account ID Refinements
**Existing transaction headers to study:**
- `src/sdk/main/include/NodeCreateTransaction.h`
- `src/sdk/main/include/NodeUpdateTransaction.h`
- `src/sdk/main/include/NodeDeleteTransaction.h`
- `src/sdk/main/include/Endpoint.h`
If you have questions, the community is happy to help:
https://discord.com/channels/905194001349627914/1337424839761465364
Contributor guide
Assessment
This issue has not been assessed yet.