Gift claim feature

Does Canton have a daml template that supports claiming tokens that are locked without adding recipients?

For example, I think like this: at the UI level, user Bob creates a gift card, for example, 5 CC and sends it to his family or friends, and his friends only need to scan the gift card to claim the 5 CC gift.

At the blockchain level, when Bob types 5 CC, the 5 CC will be locked at the blockchain level. When the CC is claimed, the CC is transferred to the party ID that claims the gift.

@devaskardex Yes, this pattern is definitely possible in Canton/Daml, but there isn’t a built-in generic “gift card” template out of the box that automatically does this for you.

Typically, you’d model it as a locked claimable contract, for example:

  • Bob locks 5 CC into a “Gift” contract

  • The contract contains:

    • the amount

    • a claim secret / QR payload / token

    • expiry rules (optional)

    • claim status

  • Whoever presents the correct claim proof can exercise a Claim choice

  • On claim, the workflow transfers the 5 CC to the claimant’s Party

The important design question is identity and authorization:

  • If the recipient is unknown upfront, you usually authenticate the claimant via:

    • signed token

    • QR secret

    • OTP/code

    • external identity flow

  • Then map that successfully authenticated user to a Party ID during the claim flow.

From a Daml perspective, this is essentially:

  • escrow/locked state

  • single-use claim transition

  • optional expiry/reclaim path for Bob if unclaimed

One thing to be careful about is replay/double-claim protection - the claim contract should be consumed atomically so the gift can only be redeemed once.

Thank you for your response, it’s great, I will try the model you suggested.