Setup
For the following examples we will use these accounts:Basic Examples
Unconditional Claimable Balance
Create a claimable balance that can be claimed immediately by the recipient:Multiple Claimants
Create a claimable balance that can be claimed by any of multiple recipients:Time-Based Predicates
Before Absolute Time
Create a claimable balance that must be claimed before a specific date:Before Relative Time
Create a claimable balance that must be claimed within 1 hour (3600 seconds) from creation:Logical Predicates
Not Predicate
Create a claimable balance that can be claimed after a certain time (NOT before relative time):And Predicate
Create a claimable balance with multiple conditions that must ALL be true:Or Predicate
Create a claimable balance where either condition can be true:Complex Examples
Mixed Claimants with Different Predicates
Create a claimable balance with multiple claimants having different claim conditions:- Bob can claim within 1 hour
- Charlie can claim after 1 day has passed
Escrow-Style Payment
Create an escrow where the recipient has 30 days to claim, otherwise it returns to sender:- Bob can claim within 30 days
- Alice can reclaim after 30 days if Bob hasn’t claimed
Custom Asset Claimable Balance
Create a claimable balance for a custom asset:cookbooktest.ignore
Understanding Predicates
Note: Predicates must be valid JSON, so you must use proper quoting and escaping.Predicate Types
Time Format Notes
- Absolute times: Use Unix timestamps (seconds since epoch)
- Relative times: Seconds from claimable balance creation time
- Timestamps: Must be in the future when creating the balance
Common Use Cases
1. Simple Payment with Deadline
2. Delayed Payment
3. Emergency Fund
Notes
--amount: Amount in stroops (1 XLM = 10,000,000 stroops)--asset: Use “native” for XLM or “CODE:ISSUER” format for other assets--claimant: Account with optional predicate (can be specified multiple times)- Predicates are evaluated when the claimable balance is claimed, not when created
AndandOrpredicates must have exactly 2 sub-predicates- Complex predicates can be nested to create sophisticated claim conditions