# Attestor Setup Guide

How to set up and run an attestor client on Igra Mainnet. For the canonical source, see the [attestor-deploy repo](https://github.com/IgraLabs/attestor-deploy).

> **Running with a cold-wallet stake?** See [Delegated Attestation Setup](/igralabs-docs/for-attesters/delegated-attestation-setup.md) — the recommended mode when your staked wallet is a hardware wallet or otherwise shouldn't be on a live server.

## Registering as an Attester

Registration is permissionless — anyone with enough IGRA tokens can register. No admin approval required.

**Minimum stake:** 400,000 IGRA

All registration steps can be done via the [attester dashboard](https://attester-dashboard.igralabs.com/?network=mainnet) UI. The contract calls below are for reference.

### Steps

1. **Approve** the IGRA token spend on the Attestation Diamond:

```solidity
igraToken.approve(0xc24Df70E408739aeF6bF594fd41db4632dF49188, stakeAmount);
```

2. **Register** by calling `register()` on the [Attestation Diamond](https://explorer.igralabs.com/address/0xc24Df70E408739aeF6bF594fd41db4632dF49188):

```solidity
diamond.register(attesterAddress, stakeAmount);
```

The caller provides the IGRA tokens, and `attesterAddress` becomes the registered attester. These can be different addresses — you can stake on behalf of someone else.

3. **Wait 7,200 blocks** (\~2 hours) for the activation delay.
4. **Activate** — the attester address itself calls:

```solidity
diamond.activate();
```

After activation, the attester can begin submitting attestations.

## Pre-requisites

### 1. Node version and sync

Make sure your node runs the most recent client version (v2.3 at this moment) and is fully synced. Compare your latest block with the public RPC:

```bash
# Your node's latest block:
curl -s http://localhost:9545 -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | jq -r '.result' | xargs printf "%d\n"

# Public RPC latest block:
curl -s https://rpc.igralabs.com:8545 -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | jq -r '.result' | xargs printf "%d\n"
```

Both should return the same (or very close) block number.

### 2. At least 1 funded KAS wallet

The attestor submits transactions through `rpc-provider-0` → `kaswallet-0`. Only wallet #0 needs KAS. You don't need all 5 wallets funded for attesting.

### 3. RPC enabled

Set `RPC_READ_ONLY=false` in your `.env` and at least the `frontend-w1` profile running. Test it:

```bash
curl -s https://<your-domain>:8545 -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | jq .
```

If you don't have a domain, test locally:

```bash
curl -s http://localhost:9545 -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | jq .
```

### 4. 5-10 iKAS on attester wallet

This covers L2 gas for attestation transactions. L2 gas is refunded for successful attestations, but **not** for reverted or unselected ones. L1 gas (KAS) is never refunded, but the cost is negligible (\~0.00003 KAS per attestation).

### 5. Attester private key ready

You'll need the private key for your registered attester wallet.

## Setup

```bash
git clone https://github.com/IgraLabs/attestor-deploy.git
cd attestor-deploy
./setup.sh mainnet
```

The script will:

* Create `.env` from the mainnet template
* Verify the `igra-orchestra` Docker network is running
* Prompt for your attester private key
* Start the attestor container

## Post-setup: Fix permissions

After first run, fix file permissions if the attestor crashes with permission errors:

```bash
chmod 644 secrets/private_key.txt
chmod 777 logs/
docker compose restart
```

## Verify

Check the attestor is running and healthy:

```bash
curl -s localhost:8180 | jq .
```

You should see `"status": "healthy"` and `"state": "Active"` (or `"PendingActivation"` if recently registered).

Once active, you can monitor your attester status and rewards at `https://attester-dashboard.igralabs.com/?network=mainnet&address=YOUR_ATTESTER_ADDRESS`.

## Rewards and Gas Costs

Your attester dashboard shows status, attestation count, and pending rewards:

| Metric         | Description                                            |
| -------------- | ------------------------------------------------------ |
| IGRA (pending) | IGRA token rewards earned from attesting               |
| iKAS (pending) | iKAS rewards earned from attesting                     |
| Gas refunds    | Total iKAS refunded for gas costs                      |
| IAS Score      | Igra Attestation Score — cumulative reliability metric |

To claim rewards, connect to the attester dashboard with your **attester wallet** — rewards can only be claimed by the registered attester address.


---

# 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://igra-labs.gitbook.io/igralabs-docs/for-attesters/attestor-setup-guide.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.
