XP Rewards Integration
Reward your existing users with on-chain experience points (XP). This template handles the process of issuing XP directly to users based on their unique identifier, making it easy to integrate gamification into your existing application.
Use cases
- Loyalty Program - Reward users for their continued engagement and loyalty. Users earn experience points (XP) for actions such as logging in daily, making purchases, or referring friends.
- Achievement System - Implement an achievement system where users earn XP for completing specific milestones or challenges within your application.
- Event Participation - Award XP to users for participating in special events, contests, or promotions.
Video Setup
Prerequisites
-
Setup OPENFORMAT
Before you can continue, please complete the following steps to obtain the necessary credentials:
- Go to the OPENFORMAT Dashboard
- Register for an account
- Generate an API Key
- Create a dApp
- Create a Badge (only if required)
-
Supabase Table
Create a Supabase table for storing generated web3 accounts for a given user_id
. Follow the table structure below. You will need to add the following columns: account_address
, private_key
and user_id
.
Disable Row Level Security (RLS) for testing purposes only. We highly recommend enabling RLS in any production environment to ensure data security and integrity.
Get Started
Remix this template
Clone this template in BuildShip.
Supabase Node Inputs
Add your Supabase API Key
and API URL
to the Get Row and
Create Row node inputs.
OPENFORMAT Node Inputs
Add your OPENFORMAT API Key
, dApp ID
and Private Key
into
the Reward XP Node inputs.
Test Integration
To test the integration, click on Test and add the user_id
of your user to the body of the request. e.g.
Generate a Leaderboard
Now that you’ve rewarded XP to a user, you can generate a leaderboard using the Leaderboard Template.
Node Inputs
Reward XP
Key | Description |
---|---|
API Key | Your OPENFORMAT API Key. You can find this in the Settings page of the Dashboard (String) |
dApp ID | The ID of your OPENFORMAT dApp. You can get this in the Dashboard (String, max 32 characters) |
Private Key | The Private Key of your web3 account. You can find this in the Settings page of the Dashboard. |
Action ID | A random identifier for the action that has been completed, e.g., completed_workout , completed_lesson . (String, max 32 characters) |
Amount of XP | The amount of XP to be rewarded. (Number, whole number only) |
Receiver | The address of the receiver, which will be the existing web3 account or the newly generated account. |
Await | Wait for the transaction to be confirmed on the blockchain. (Boolean, default: true) |