# 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
