Skip to main content

Users and Profiles

Difference between users and profiles in Honeycomb Protocol

In the Honeycomb Protocol, users and profiles are distinct:

  • User: A person with a universal account, allowing access to any Honeycomb app. Users can link their Steam, Twitter, Discord, and Civic IDs for enhanced functionality, with Civic ID used for KYC verification.

  • Profile: Specific to each project within the ecosystem. For instance, a user needs separate profiles for a social media app and a game. The social media profile tracks posts, comments, and friends, while the game profile tracks achievements, scores, and in-game purchases. In order to create profiles, you need to create a profiles tree.

In summary, the same user can have different profiles for different apps within the Honeycomb Protocol.

Users

Before you can create a profile for your project, you need to create a user. Let's cover how you can create a user.

Creating a user

const {
createNewUserTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction through client.sendBulkTransactions
} = await client.createNewUserTransaction({
wallet: userPublicKey.toString(), // User's wallet public key
info: { // Optional, user's information
name: "Test User",
username: "testuser",
pfp: "https://lh3.googleusercontent.com/-Jsm7S8BHy4nOzrw2f5AryUgp9Fym2buUOkkxgNplGCddTkiKBXPLRytTMXBXwGcHuRr06EvJStmkHj-9JeTfmHsnT0prHg5Mhg",
bio: "This is a test user",
},
socialInfo: { // Optional, user's socials
discord: "1238418214089",
twitter: "userTwitter",
civic: "civicId",
steam: "steamId",
},
payer: adminPublicKey.toString(), // Optional, the transaction payer's public key
});

Create user and profile

const { 
createNewUserWithProfileTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction through client.sendBulkTransactions
} = await client.createNewUserWithProfileTransaction({
project: projectAddress.toString(),
wallet: userPublicKey.toString(),
payer: adminPublicKey.toString(),
profileIdentity: "main",
userInfo: { // Optional
username: "hcDev",
name: "Honeycomb Developer",
bio: "This user is created for testing purposes",
pfp: "https://lh3.googleusercontent.com/-Jsm7S8BHy4nOzrw2f5AryUgp9Fym2buUOkkxgNplGCddTkiKBXPLRytTMXBXwGcHuRr06EvJStmkHj-9JeTfmHsnT0prHg5Mhg",
},
profileInfo: { // Optional
bio: "John Doe's Bio",
name: "John Doe",
pfp: "link-to-pfp"
}
});

Profiles

Profiles are specific to each project within the Honeycomb Protocol ecosystem. Let's cover how you can create a profile for your project.

Before you can start creating profiles for your project, you'll need to create a profiles tree. Let's cover that first.

Create a profiles tree

const {
createCreateProfilesTreeTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction through client.sendBulkTransactions
} = await client.createCreateProfilesTreeTransaction({
payer: adminPublicKey.toString(),
project: projectAddress.toString(),
treeConfig: {
// Provide either the basic or advanced configuration, we recommend using the basic configuration if you don't know the exact values of maxDepth, maxBufferSize, and canopyDepth (the basic configuration will automatically configure these values for you)
basic: {
numAssets: 100000, // The desired number of profiles this tree will be able to store
},
advanced: {
maxDepth: 20,
maxBufferSize: 64,
canopyDepth: 14,
}
}
});

Creating a profile

const {
createNewProfileTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction through client.sendBulkTransactions
} = await client.createNewProfileTransaction({
project: projectAddress.toString(), // The project's public key
payer: userPublicKey.toString(), // The transaction payer's public key, the profile will also be created for this payer
identity: "main", // Identity type in string, the value depends on the project's needs
info: { // Optional, profile information, all values in the object are optional
bio: "My name is John Doe",
name: "John Doe",
pfp: "link-to-pfp"
}
});

Update profile

const {
createUpdateProfileTransaction: txResponse // This is the transaction response, you'll need to sign and send this transaction through client.sendBulkTransactions
} = await client.createUpdateProfileTransaction({
payer: userPublicKey.toString(),
profile: profile.address,
info: {
bio: "This is profile of user",
name: "User",
pfp: "link-to-pfp"
},
customData: {
add: [ // Here you can add any custom data to a user's profile, the format is given below (please always use key: ["string"])
location: ["San Francisco, CA"],
website: ["https://johndoe.dev"],
github: ["https://github.com/johndoe"],
stars: ["55"]
],
remove: [ // Provide any keys for custom data you want to remove from the profile, the key-value pairs will be removed, the format is given below
"collaborations" // This will remove the key "collaborations" from the profile along with the corresponding value
]
}
});