Skip to main content

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.

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",
]
}
});

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

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
});

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

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
}
]
}
}
});

Modifying a delegate authority

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,
},
}
}
});

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:

  1. 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.
  2. 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

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
},
});

Update a badge

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
},
});

Give/assign a badge to a user profile

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)
},
});