Add micro-quests to your app/game
Introduction
Honeycomb Protocol has a robust quest system that lets you create missions for your users. Upon completing those missions, your users get awarded with XP and tokens.
In addition to our missions, we've also gotten a lot of queries from developers to add micro-quests support to Honeycomb. For example: developers might want to reward their users for connecting their wallet for the first time, or for completing a certain action in their app like discovering a new area.
This guide will walk you through how you can add rewards when your users/players complete these micro-tasks.
Prerequisites
Before following this guide, make sure you already have the following:
- An existing Honeycomb project
- A profiles tree (Profile trees are used to store profile data for your users)
- At least one resource (In case you want to reward your users with tokens)
Step by step guide
1. Define a criteria and a detection mechanism in your app/game
First, you need to define the criteria for your micro-quest. For example, you might want to reward your users for creating a new profile. We'll take that as an example for this guide.
When the user creates their profile, you'll need to detect that action in your app/game. Then you'll send a request to your server(s) to process the reward.
2. Use Honeycomb Protocol to reward your users
Once you've detected the action and verfied it on your server-side, you can reward your users according to any custom criteria you set.
Here's an example of how you can reward your users with XP that'll get added to their in-app/in-game profile:
As these actions use either the project authority keypair or delegate authority keypair, they should never be exposed to the front-end. Always keep any and all authority keypairs secure on your server-side.
const { createUpdatePlatformDataTransaction: txResponse } = await client.createUpdatePlatformDataTransaction({
profile: profileAddress.toString(), // The profile's public key
authority: adminKeypair.publicKey.toString(), // The public key of the project authority
platformData: {
addXp: 100, // Specify the amount of XP you want to add
},
});
And here's an example of how you can reward your users with tokens:
const {
createMintResourceTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createMintResourceTransaction({
resource: resourceAddress.toString(), // Resource public key as a string
amount: "50000", // Specify the amount of the resource to mint
authority: adminPublicKey.toString(), // Project authority's public key
owner: userPublicKey.toString(), // The owner's public key, this wallet will receive the resource
delegateAuthority: delegateAuthorityPublicKey.toString(), // Optional, if specified, the delegate authority will be used to mint the resource
payer: adminPublicKey.toString(), // Optional, specify when you want a different wallet to pay for the tx
});
There's also a third option for rewards, you can reward your users with in-game characters, upgrade their in-game characters' stats, and more. If you'd like to know more about this, take look at the assembling characters page.
It's up to the developers how to handle these rewards. You can reward with XP, tokens, characters, or a combination of them.
Honeycomb is designed to be as modular as possible, so developers have complete freedom to design their in-app economies and reward systems.