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.
If you'd like to integrate any app or game with Honeycomb Protocol, you'll need to create a project. That project will have its own public key and will essentially represent your app on the blockchain.
Once you have a project, you can create user profiles, resources, characters, missions, and other on-chain assets under it. Honeycomb Protocol is designed to be modular, so you can pick and choose the modules you need in your app.
Creating a project
Here's how you can create a project on Honeycomb Protocol.
- JavaScript
- GraphQL
- Unity/C#
- Godot
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
# client is an instance of the Honeycomb node
client.create_create_project_transaction(
authority_address, // Public key of the project authority, who has complete control over the project
"Test Project", // Name of the project
"", // Description
[], // Tags
null, // Category
false, // Is private
payer_address // Optional: public key of the payer, who pays the transaction fees
)
var response = await client.query_response_received
// This is the project address once it'll be created
var project_address = response.createCreateProjectTransaction.project
// This is the transaction response, you'll need to sign and send this transaction
var transaction = response.createCreateProjectTransaction.tx
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#
- Godot
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);
client.create_change_project_driver_transaction(
project_address, // The project's public key
driver_address, // The new driver's public key
authority_address, // Provide the project authority's public key
payer_address // Optional: the transaction payer's public key
)
var response = await client.query_response_received
var transaction = response.createChangeProjectDriverTransaction
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#
- Godot
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: {
HiveControl: [ // Put the service name here, for example: HiveControl
{
// Each service's permissions enum can be imported from @honeycomb-protocol/edge-client
permission: HiveControlPermissionInput.ManageProjectDriver,
// 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
var service_delegation_input: ServiceDelegationInput = load("res://://path/to/cservice_delegation_input.tres")
client.create_create_delegate_authority_transaction(
project_address, // The project's public key
delegate_address, // The delegate's public key
service_delegation_input,
authority_address, // Provide the project authority's public key
payer_address // Optional: the transaction payer's public key
)
var response = await client.query_response_received
var transaction = response.createCreateDelegateAuthorityTransaction
Modifying a delegate authority
- JavaScript
- GraphQL
- Unity/C#
- Godot
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.ManageProjectDriver,
},
}
}
});
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.ManageProjectDriver // 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
var modify_delegation_input: ModifyDelegationInput = load("res://path/to/modify_delegation_input.tres")
client.create_modify_delegation_transaction(
project_address, // The project's public key
delegate_address, // The delegate's public key
modify_delegation_input,
authority_address, // Provide the project authority's public key
payer_address // Optional: the transaction payer's public key
)
var response = await client.query_response_received
var transaction = response.createModifyDelegationTransaction
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#
- Godot
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
// Load the new badge criteria input resource
var badge_criteria_input: UpdateBadgeCriteriaInput = load("res://path/to/badge_criteria_input.tres")
// Set the badge criteria input properties
badge_criteria_input.authority = authority_address // Project authority public key
badge_criteria_input.projectAddress = project_address // Project public key
badge_criteria_input.startTime = int(Time.get_unix_time_from_system()) // Optional start time as an integer, UNIX timestamp
badge_criteria_input.endTime = int(Time.get_unix_time_from_system() + 60 * 60 * 24 * 7) // Optional end time, UNIX timestamp
badge_criteria_input.criteriaIndex = 0 // Badge index as an integer, used to identify the badge
badge_criteria_input.payer = payer_address // Optional transaction payer public key
badge_criteria_input.condition = BadgesCondition.get_public() // Badge condition, only Public is available for now
// Create a new badge criteria transaction
client.create_initialize_badge_criteria_transaction(badge_criteria_input)
var response = await client.query_response_received
var transaction = response.createInitializeBadgeCriteriaTransaction
Update a badge
- JavaScript
- GraphQL
- Unity/C#
- Godot
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
var badge_criteria_input: UpdateBadgeCriteriaInput = load("res://path/to/badge_criteria_input.tres")
// Set the badge criteria input properties
badge_criteria_input.authority = authority_address // Project authority public key
badge_criteria_input.projectAddress = project_address // Project public key
badge_criteria_input.startTime = int(Time.get_unix_time_from_system()) // Optional start time as an integer, UNIX timestamp
badge_criteria_input.endTime = int(Time.get_unix_time_from_system() + 60 * 60 * 24 * 7) // Optional end time, UNIX timestamp
badge_criteria_input.criteriaIndex = 0 // Badge index as an integer, used to identify the badge
badge_criteria_input.payer = payer_address // Optional transaction payer public key
badge_criteria_input.condition = BadgesCondition.get_public() // Badge condition, only Public is available for now
// Create a new badge criteria transaction
client.create_update_badge_criteria_transaction(badge_criteria_input)
var response = await client.query_response_received
var transaction = response.createUpdateBadgeCriteriaTransaction
Give/assign a badge to a user profile
- JavaScript
- GraphQL
- Unity/C#
- Godot
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
// Load the new claim badge criteria input resource
var claim_badge_input: ClaimBadgeCriteriaInput = load("res://path/to/new_claim_badge_criteria_input.tres")
// Set the claim badge criteria input properties
claim_badge_input.criteriaIndex = 0 // Badge index as an integer, used to identify the badge
claim_badge_input.profileAddress = profile_address // User profile public key, this profile will be assigned the badge
claim_badge_input.projectAddress = project_address // Project public key
claim_badge_input.proof = "Public" // Proof of the badge, only Public is available for now
claim_badge_input.payer = payer_address // Transaction payer public key
client.create_claim_badge_criteria_transaction(claim_badge_input)
var response = await client.query_response_received
var transaction = response.createClaimBadgeCriteriaTransaction