Examples
Worked workflow patterns using the Hedera node
1. Check a Balance Before a Payout Step
Guard a downstream payout/transfer action by confirming the treasury account has enough HBAR first.
- Hedera node:
resource=account,operation=getBalance,accountId={{treasuryAccountId}} - Condition node:
balanceHbar >= requiredAmount - If true, continue to the payout step; if false, route to an alert/notification branch
Why here: This is a read-only pre-check — it doesn't move funds itself, it just
protects a later step (today, likely an off-chain payout or a manual approval) from firing against an
account that can't cover it.
2. Poll an HCS Topic as a Workflow Trigger
Use a topic as a lightweight event bus: an external system submits messages to it, and a workflow polls for new ones.
- Store the last processed
sequenceNumbersomewhere the workflow can read/write (a variable, a small table row). - On each run: Hedera node,
resource=topic,operation=getMessages,topicId={{topicId}},sequenceFrom={{lastSeen + 1}} - For each message returned, parse the JSON payload and branch on its
eventfield. - Update the stored
sequenceNumberto the highest one seen this run.
Tip: Keep
limit modest (25–50) on a frequent poll — you'll catch up
quickly across a few runs rather than requesting a huge page every time.
3. Look Up a Token and an Account's Holdings Together
Combine token metadata with a specific account's balance, e.g. to display "Account X holds 500 EXT (Example Token)" in a report.
- Hedera node:
resource=token,operation=getInfo,tokenId={{tokenId}}→ getsymbol,decimals,name - Hedera node:
resource=token,operation=getBalances,accountId={{accountId}}→ find the entry matchingtokenId - Transform step:
displayAmount = balance / (10 ^ decimals), format as"{displayAmount} {symbol}"
4. Convert a User-Entered HBAR Amount Before a Downstream Step
A form collects an amount in HBAR from a user; a later step (today, an off-chain ledger entry; eventually, a signed transfer — see Roadmap) needs tinybar.
- Hedera node:
resource=utility,operation=convertUnits,amount={{userInputHbar}},fromUnit=hbar,toUnit=tinybar - Pass
result(the tinybar amount) into the downstream step's input field.
5. Validate a User-Entered Account ID Before Any Lookup
- Hedera node:
resource=utility,operation=validateAddress,address={{userInput}} - Condition node:
isValid == true - If true, proceed to
account.getBalanceoraccount.getInfo; if false, return a validation error to the user immediately instead of calling the network.