Another solution is to have Alice create and fund a new account C and sign a timebound transaction to merge C into Bob account. Then she can share the transaction with Bob before his birthday, he has the transaction but he has to wait his birthday to submit it to the network and redeem his gift.
Alice can set the thresholds and signatures weighs of C so that Bob knows she can't move the funds out of the account before his birthday.
First Alice needs to build the merge account transaction (here n
is the Contract account sequence):
Transaction #2
- Source: C
- Sequence:
n+2
- Time Bounds: (min=bob birthday, max=0)
- Operations:
- Operation
- Type: AccountMerge
- Destination: B
Alice would write down the transaction hash h(#2)
and XDR.
To setup the Contract C, Alice would send the following transaction to the network:
Transaction #1
- Source: C
- Sequence:
n+1
- Operations:
- Operation
- Type: SetOptions
- MasterWeight: 0
- LowThreshold: 2
- MediumThreshold: 2
- HighThreshold: 2
- Signer: (type=ed25519, key=B, weight=1)
- Operation
- Type: SetOptions
- Signer: (type=pre-auth-tx, hash=
h(#2)
, weight=1)
On the day of its birthday, Bob would sign and submit transaction #2 to receive Alice gift. Before that date, neither Bob nor Alice are able to withdraw the funds.