Projects
Pre-requisites
Before following this guide, make sure you go through our getting started guide and set up your development environment.
If you need any help at any point, please get in touch.
What are projects
Projects are the core of the Honeycomb Protocol. Essentially, a project represents an app. It can be game or it can any app that takes advantage of the blockchain.
All the currencies, profiles, characters, missions, resources, and other elements are associated with a project.
Creating a project
Here's how you can create a project on Honeycomb Protocol.
- JavaScript
- GraphQL
- Unity/C#
const {
createCreateProjectTransaction: {
project: projectAddress, // This is the project address once it'll be created
tx: txResponse, // This is the transaction response, you'll need to sign and send this transaction
},
} = await client.createCreateProjectTransaction({
name: "Test Project", // Name of the project
authority: authorityPublicKey, // Public key of the project authority, this authority has complete control over the project
payer: payerPublicKey, // Optional public key of the payer, the payer pays the transaction fees for creating this project
profileDataConfig: {
achievements: [ // Specify an array of achievements that you want to be able to set on your users' profiles
"Pioneer"
],
customDataFields: [ // Specify an array of custom data fields that you want to be able to set on your users' profiles
"NFTs owned",
]
}
});
query CreateCreateProjectTransaction($authority: String!, $name: String!, $driver: String, $payer: String, $profileDataConfig: ProfileDataConfigInput, $associatedPrograms: [AssociatedProgramInput!]) {
createCreateProjectTransaction(authority: $authority, name: $name, driver: $driver, payer: $payer, profileDataConfig: $profileDataConfig, associatedPrograms: $associatedPrograms) {
project
tx {
blockhash
lastValidBlockHeight
transaction
}
}
}
Provide the data like this:
{
"authority": "pubkey", // Public key as a string
"name": "string", // Name of the project
"driver": "pubkey", // Optional pubkey for the project driver
"payer": "pubkey", // Public key as a string
"profileDataConfig": {
"achievements": ["string"], // Achievements as a string array, these achievements can be added to the project profiles
"customDataFields": ["string"], // Custom data fields as a string array, these custom fields can be added to the project profiles
},
"associatedPrograms": [
{
"address": "pubkey", // Public key of the associated program as a string
"trustedActions": [
{
"kind": "string", // The kind of trusted action as a string
}
]
}
]
}
var createProjectParams = new CreateCreateProjectTransactionParams
{
Name = "Test Project", // Name of the project
Authority = authorityPublicKey, // Public key of the project authority, who has complete control over the project
Payer = payerPublicKey, // Optional: public key of the payer, who pays the transaction fees
ProfileDataConfig = new ProfileDataConfigInput
{
Achievements = new List<string> // Specify an array of achievements for user profiles
{
"Pioneer",
},
CustomDataFields = new List<string> // Specify an array of custom data fields for user profiles
{
"NFTs owned"
}
}
};
// Create a project transaction
var tx = await Client.CreateCreateProjectTransaction(createProjectParams)
// Extract project address and transaction response from the result
var projectAddress = tx.CreateCreateProjectTransaction.Project; // This is the project address once created
var txResponse = tx.CreateCreateProjectTransaction.Tx; // This is the transaction response, which you'll need to sign and send
For more information on trustedActions, see the Honeycomb Trusted Actions documentation.
Project driver
The project driver's keypair can be used to sign a project's transactions when neither the user nor the project admin's signature is required.
In such instances, the project driver’s keypair provides the necessary authorization, ensuring that transactions can execute without direct interaction from the user or admin.
Changing the project driver
- JavaScript
- GraphQL
- Unity/C#
const {
createChangeProjectDriverTransaction: txResponse, // This is the transaction response, you'll need to sign and send this transaction
} = await client.createChangeProjectDriverTransaction({
authority: adminPublicKey.toString(), // Provide the project authority's public key
project: projectAddress.toString(), // The project's public key
driver: newDriverAddress.toString(), // The new driver's public key
payer: payerPublicKey.toString() // Optional, the transaction payer's public key
});
query CreateChangeProjectDriverTransaction($project: String!, $driver: String!, $authority: String!, $payer: String) {
createChangeProjectDriverTransaction(project: $project, driver: $driver, authority: $authority, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, the new driver's wallet address, and the authority's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"driver": "pubkey", // New driver's pubkey address in string format
"authority": "pubkey", // Authority's pubkey address in string format
"payer": "pubkey" // Optional, transaction payer's pubkey address in string format
}
var changeDriverParams = new CreateChangeProjectDriverTransactionParams
{
Authority = adminPublicKey.ToString(), // Provide the project authority's public key
Project = projectAddress.ToString(), // The project's public key
Driver = newDriverAddress.ToString(), // The new driver's public key
Payer = payerPublicKey.ToString() // Optional: the transaction payer's public key
};
// Create a change project driver transaction
var txResponse = await Client.CreateChangeProjectDriverTransaction(changeDriverParams);
Delegates
A project's authority has complete control over that project. But sometimes, you may want to give another account the ability to act on your behalf. This is where delegates come in.
Honeycomb Protocol lets you define delegate authorities that can make certain changes to your project without having full control over it. You, as the project authority, will get to fine-tune the permissions you want to give your delegates.
Creating a delegate authority
- JavaScript
- GraphQL
- Unity/C#
import { HiveControlPermissionInput } from '@honeycomb-protocol/edge-client';
const {
createCreateDelegateAuthorityTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createCreateDelegateAuthorityTransaction({
authority: adminPublicKey.toString(),
delegate: delegatePublicAddress.toString(),
project: projectAddress.toString(),
payer: txPayerPublicKey.toString(), // Optional, the transaction payer's public key
serviceDelegations: {
serviceDelegations: {
HiveControl: [ // Put the service name here, for example: HiveControl
{
// Each service's permissions enum can be imported from @honeycomb-protocol/edge-client
permission: HiveControlPermissionInput.ManageProfiles,
// In some cases an index will also be required in this object, for example: index: 0
}
]
}
}
});
query CreateCreateDelegateAuthorityTransaction($project: String!, $serviceDelegations: ServiceDelegationInput!, $authority: String!, $delegate: String!, $payer: String) {
createCreateDelegateAuthorityTransaction(project: $project, serviceDelegations: $serviceDelegations, authority: $authority, delegate: $delegate, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, service delegations, authority's wallet address, delegate's wallet address, and payer's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"serviceDelegations": {
"ServiceName": [ // For service name and delegations, refer to the services and delegations section
{
"index": int,
"permission": "string" // For service name and delegations, refer to the services and delegations section
}
],
},
"authority": "pubkey", // Project authority's pubkey address in string format
"delegate": "pubkey", // Delegate's pubkey address in string format
"payer": "pubkey" // Payer's pubkey address in string format
}
var createDelegateAuthorityParams = new CreateCreateDelegateAuthorityTransactionParams
{
authority: adminPublicKey.ToString(), // Provide the project authority's public key
delegate: delegatePublicAddress.ToString(), // The delegate's public address
project: projectAddress.ToString(), // The project's public key
payer: txPayerPublicKey.ToString(), // Optional: the transaction payer's public key
serviceDelegations: new ServiceDelegationInput
{
HiveControl: new List<ServiceDelegationHiveControl> // Specify the service name, e.g., HiveControl
{
new ServiceDelegationHiveControl
{
// Each service's permissions enum can be imported from using HplEdgeClient.Enums;
permission: HiveControlPermissionInput.ManageCriterias // Permission enum for the service
// In some cases, an index will also be required in this object, for example: index: 0
}
}
}
};
// Create a delegate authority transaction
var txResponse = await Client.CreateCreateDelegateAuthorityTransaction(createDelegateAuthorityParams);
// txResponse now contains the transaction response, which you'll need to sign and send
Modifying a delegate authority
- JavaScript
- GraphQL
- Unity/C#
const {
createModifyDelegationTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction
} = await client.createModifyDelegationTransaction({
authority: adminPublicKey.toString(), // Provide the project authority's public key
project: projectAddress.toString(), // The project's public key
delegate: delegatePublicKey.toString(), // The delegate's public key
modifyDelegation: {
delegation: {
HiveControl: {
permission: HiveControlPermissionInput.ManageProfiles,
},
}
}
});
query CreateModifyDelegationTransaction($project: String!, $delegate: String!, $modifyDelegation: ModifyDelegationInput!, $authority: String!, $payer: String) {
createModifyDelegationTransaction(project: $project, delegate: $delegate, modifyDelegation: $modifyDelegation, authority: $authority, payer: $payer) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the project ID, delegate's wallet address, modify delegation object, authority's wallet address, and payer's wallet address like this:
{
"project": "pubkey", // Project's pubkey address in string format
"delegate": "pubkey", // Delegate's pubkey address in string format
"modifyDelegation": {
"ServiceName": [ // For service name and delegations, refer to the services and delegations section
{
"index": int,
"permission": "string" // For service name and delegations, refer to the services and delegations section
}
],
},
"authority": "pubkey", // Project authority's pubkey address in string format
"payer": "pubkey" // Payer's pubkey address in string format
}
// Create parameters for modifying the delegation transaction
var createModifyDelegationParams = new CreateModifyDelegationTransactionParams
{
Authority = adminPublicKey.ToString(), // Provide the project authority's public key
Project = projectAddress.ToString(), // The project's public key
Delegate = delegatePublicKey.ToString(), // The delegate's public key
ModifyDelegation = new ModifyDelegationInput
{
Delegation = new ModifyServiceDelegationInput
{
HiveControl = new ServiceDelegationHiveControl
{
Permission = HiveControlPermissionInput.ManageProfiles // Set the permission for the service
}
}
},
};
// Create a modify delegation transaction using the specified parameters
var txResponse = await Client.CreateModifyDelegationTransaction(createModifyDelegationParams);
// txResponse now contains the transaction response, which you'll need to sign and send
Here are the details about services and delegations.
Badges
Badges are essentially achievements that users can earn in your app. But you already define an array of achievements in the profileDataConfig when creating a project, right? So what's the difference between badges and achievements?
There are two key differences:
- Badges can be timed, with the start and end times of a badge defined within the badge account in Unix format, meaning your users will only be able to claim them within the start and end time of a badge. Outside of that window (if a window has been defined) the transaction will automatically fail.
- In order to get a badge, your users don't need the transaction to be signed by the project authority. If you assign an achievement (from the profileDataConfig's achievements array) to a user, the project authority needs to sign the transaction. Essentially, a badge is claimable with just the user's signing for the transaction.
Create a badge
- JavaScript
- GraphQL
- Unity/C#
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const {
createCreateBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
},
} = await client.createCreateBadgeCriteriaTransaction({
args: {
authority: authorityPublicKey, // Project authority public key
projectAddress: projectAddress, // Project public key
payer: payerPublicKey, // Optional transaction payer public key
badgeIndex: 0, // Badge index as an integer, used to identify the badge
condition: BadgesCondition.Public, // Badge condition, only Public is available for now
startTime: 0, // Optional start time, UNIX timestamp
endTime: 0, // Optional end time, UNIX timestamp
},
});
query CreateInitializeBadgeCriteriaTransaction($args: CreateBadgeCriteriaInput!) {
createInitializeBadgeCriteriaTransaction(args: $args) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the badge criteria like this:
{
"args": {
"authority": "pubkey", // Project authority public key as a string
"projectAddress": "pubkey", // Project public key as a string
"payer": "pubkey", // Optional transaction payer public key as a string
"badgeIndex": "Int", // Badge index as an integer
"condition": "Public", // Badge condition as a string, only Public is available for now
"startTime": "Int", // Optional start time as an integer, UNIX timestamp
"endTime": "Int", // Optional end time as an integer, UNIX timestamp
}
}
// Create parameters for the create badge criteria transaction
var createBadgeCriteriaParams = new CreateInitializeBadgeCriteriaTransactionParams
{
Args = new CreateBadgeCriteriaInput
{
Authority = authorityPublicKey, // Project authority public key
ProjectAddress = projectAddress, // Project public key
Payer = payerPublicKey, // Optional transaction payer public key
BadgeIndex = 0, // Badge index as an integer, used to identify the badge
Condition = BadgesCondition.Public, // Badge condition, only Public is available for now
StartTime = 0, // Optional start time, UNIX timestamp
EndTime = 0, // Optional end time, UNIX timestamp
}
};
// Create a create badge criteria transaction
var txResponse = await Client.CreateInitializeBadgeCriteriaTransaction(createBadgeCriteriaParams);
// Extract relevant information from the transaction response
var blockhash = txResponse.CreateInitializeBadgeCriteriaTransaction.Blockhash; // Blockhash of the transaction
var lastValidBlockHeight = txResponse.CreateInitializeBadgeCriteriaTransaction.LastValidBlockHeight; // Last valid block height
var transaction = txResponse.CreateInitializeBadgeCriteriaTransaction; // The transaction object
Update a badge
- JavaScript
- GraphQL
- Unity/C#
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const {
createUpdateBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
},
} = await client.createUpdateBadgeCriteriaTransaction({
args: {
authority: authorityPublicKey, // Project authority public key
projectAddress: projectAddress, // Project public key
payer: payerPublicKey, // Optional transaction payer public key
criteriaIndex: 0, // Badge index as an integer, used to identify the badge (when adding a badge you'll use this index)
condition: BadgesCondition.Public, // Badge condition, only Public is available for now
startTime: 0, // Optional start time, UNIX timestamp
endTime: 0, // Optional end time, UNIX timestamp
},
});
query CreateUpdateBadgeCriteriaTransaction($args: UpdateBadgeCriteriaInput!) {
createUpdateBadgeCriteriaTransaction(
args: $args
) {
blockhash
lastValidBlockHeight
transaction
}
}
Provide the badge criteria like this:
{
"args": {
"authority": "pubkey", // Project authority public key as a string
"projectAddress": "pubkey", // Project public key as a string
"payer": "pubkey", // Optional transaction payer public key as a string
"criteriaIndex": "Int", // Badge index as an integer, used to identify the badge
"condition": "Public", // Badge condition as a string, only Public is available for now
"startTime": "Int", // Optional start time as an integer, UNIX timestamp
"endTime": "Int", // Optional end time as an integer, UNIX timestamp
}
}
// Create parameters for the update badge criteria transaction
var updateBadgeCriteriaParams = new CreateUpdateBadgeCriteriaTransactionParams
{
Args = new UpdateBadgeCriteriaInput
{
Authority = authorityPublicKey, // Project authority public key
ProjectAddress = projectAddress, // Project public key
Payer = payerPublicKey, // Optional transaction payer public key
CriteriaIndex = 0, // Badge index as an integer, used to identify the badge
Condition = BadgesCondition.Public, // Badge condition, only Public is available for now
StartTime = 0, // Optional start time, UNIX timestamp
EndTime = 0, // Optional end time, UNIX timestamp
}
};
// Create a update badge criteria transaction
var txResponse = await Client.CreateUpdateBadgeCriteriaTransaction(updateBadgeCriteriaParams);
// Extract relevant information from the transaction response
var blockhash = txResponse.CreateUpdateBadgeCriteriaTransaction.Blockhash; // Blockhash of the transaction
var lastValidBlockHeight = txResponse.CreateUpdateBadgeCriteriaTransaction.LastValidBlockHeight; // Last valid block height
var transaction = txResponse.CreateUpdateBadgeCriteriaTransaction; // The transaction object
Give/assign a badge to a user profile
- JavaScript
- GraphQL
- Unity/C#
import { BadgesCondition } from '@honeycomb-protocol/edge-client';
const { createClaimBadgeCriteriaTransaction: {
blockhash,
lastValidBlockHeight,
transaction,
} } =
await client.createClaimBadgeCriteriaTransaction({
args: {
profileAddress: profileAddress, // User profile public key, this profile will be assigned the badge
projectAddress: projectAddress, // Project public key
proof: BadgesCondition.Public, // Proof of the badge, only Public is available for now
payer: userPublicKey.toString(), // Transaction payer public key
criteriaIndex: 0, // Badge index as an integer, used to identify the badge (the badge that matches this index will be added to the profile)
},
});
// Create parameters for the claim badge criteria transaction
var claimBadgeCriteriaParams = new CreateClaimBadgeCriteriaTransactionParams
{
Args = new ClaimBadgeCriteriaInput
{
ProfileAddress = profileAddress, // User profile public key, this profile will be assigned the badge
ProjectAddress = projectAddress, // Project public key
Proof = BadgesCondition.Public, // Proof of the badge, only Public is available for now
Payer = userPublicKey.ToString(), // Transaction payer public key
CriteriaIndex = 0 // Badge index as an integer, used to identify the badge
}
};
// Create a claim badge criteria transaction
var txResponse = await Client.CreateClaimBadgeCriteriaTransaction(claimBadgeCriteriaParams);
// Extract relevant information from the transaction response
var blockhash = txResponse.CreateClaimBadgeCriteriaTransaction.Blockhash; // Blockhash of the transaction
var lastValidBlockHeight = txResponse.CreateClaimBadgeCriteriaTransaction.LastValidBlockHeight; // Last valid block height
var transaction = txResponse.CreateClaimBadgeCriteriaTransaction; // The transaction object