Set Representative

Keeta uses a delegated proof-of-stake (dPoS) model where every account can choose a representative to vote on its behalf in network consensus. By assigning a representative, you delegate your voting power — which is based on your token balance — to that representative.

Step-by-Step: Delegate to a Representative

1

Convert the representative's address into an Account object

This takes the public address (as a string) and turns it into a proper Account object. The assertAccount() call ensures it’s valid and usable for delegation.

const builder = userClient.initBuilder();
2

Initialize a transaction builder

The builder is used to queue operations that will be packaged into a single transaction.

builder.setRep(representativeAccount);
3

Publish the transaction to the network

This finalizes the transaction and submits it to the Keeta network. Once confirmed, your tokens will be delegated and the representative will begin voting with your power.

await userClient.publishBuilder(builder);

Your account is now linked to a representative. This means:

  • You’re participating in Keeta’s governance and consensus process.

  • Your token balance contributes to your chosen representative’s voting power.

Full Code Example

// Convert the public key string into a valid Keeta account
const representativeAccount = Client.lib.Account
  .fromPublicKeyString(data.representativeAddress)
  .assertAccount(); // Ensure it's a proper account type

// Initialize a block builder
const builder = userClient.initBuilder();

// Add a "set representative" operation
builder.setRep(representativeAccount);

// Publish the operation to the network
await userClient.publishBuilder(builder);

Last updated