Redeeming Onchain Points

Although points accrued on a Badge NFT only go up (or zeroed out on token burn), they can be redeemed for perks such as NFTs, protocol unlocks or generally any offchain perk (ex:

Once points are redeemed, the user must accrue new points for other redemptions.

The general flow is

  1. User accrues points against their badge NFT

  2. We can check their redeemable points via our peripheral contract SBTRedemption

  3. We can redeem some of their points by sending a signed struct to SBTRedemption#redeemRewardUnits

  4. On successful tx, proceed with the redemption (onchain or offchain)

How to redeem onchain points for perks

We're going to offer an API to make everything easier, but the whole process can be done client-side with a connected badge holder's wallet client.

SBTRedemption contract (Polygon) | 0x5d324d9fbb924a909B89d9cF6F311385B80477DF

SBTRedemption contract interface |

The full, self-contained React hook for fetching redeemable points + redeeming onchain can be found in this gist:

Here is a preview of the code to get a signed struct, and sending the redemption onchain

// public client for polygon
const publicClient = getPublicClient();

// the struct, provider here is a string to identify the redemption provider (ex:
const params = { provider, units: units.toString(), tokenId };

// signed typed data
const signature = await getSignedRedemptionParams(

// token owners _or_ verified addressses can redeem points
const hash = await walletClient!.writeContract({
  functionName: "redeemRewardUnits",
  args: [params, signature],
console.log(`hash: ${hash}`);

// return a `TransactionReceipt` that contains an emitted `Redemption` log
return await publicClient.waitForTransactionReceipt({ hash });

That's it! 🚀 The token holder's onchain points have been redeemed and the perks provider can continue with the fulfillment.

Last updated