> For the complete documentation index, see [llms.txt](https://docs.keeta.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeta.com/components/blocks/operations/set-representative.md).

# 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

{% stepper %}
{% step %}

### 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.

```typescript
const builder = userClient.initBuilder();
```

{% endstep %}

{% step %}

## Initialize a transaction builder

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

```typescript
builder.setRep(representativeAccount);
```

{% endstep %}

{% step %}

### 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.

```typescript
await userClient.publishBuilder(builder);
```

{% endstep %}
{% endstepper %}

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

```typescript
// 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);

```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keeta.com/components/blocks/operations/set-representative.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
