# Gas & Wallet Economics

## What this skill covers
How token economics work on Tawa — pod pricing, the deploy gate, gas metering, and wallet management.

## Token Basics

- 1 gas token = $0.01 USD
- New accounts receive 50,000 free intro tokens
- Tokens pay for two things: **hosting** (pod uptime) and **transactions** (API calls)
- Token spend order: intro tokens first, then purchased, then earned

## Pod Tiers and Pricing

| Tier | CPU | Memory | Gas/Hour | Gas/Month | USD/Month |
|------|-----|--------|----------|-----------|-----------|
| nano | 0.25 | 256Mi | 5 | 3,600 | $36 |
| small | 0.5 | 512Mi | 10 | 7,200 | $72 |
| medium | 1 | 1Gi | 23 | 16,560 | $165.60 |
| large | 2 | 2Gi | 42 | 30,240 | $302.40 |
| xlarge | 4 | 4Gi | 83 | 59,760 | $597.60 |

Set pod tier in catalog-info.yaml:
```yaml
metadata:
  annotations:
    insureco.io/pod-tier: "nano"    # Default if not specified
```

## Deploy Gate

Before every build, the builder checks your wallet has enough gas to cover 3 months of hosting:

```
Required reserve = hostingGasPerHour × 24 × 30 × 3
```

For a nano pod: 5 × 24 × 30 × 3 = 10,800 tokens ($108)

If your wallet balance is below the reserve, the deploy is blocked with:
> "Deploy gate: insufficient gas reserve"

### Platform Services Skip the Gate
These services bypass the deploy gate: iec-wallet, iec-janus, tawa-web, koko, bio-id.

### Gate is Fail-Open
If the wallet service is unreachable, deploys proceed anyway (resilience over strictness).

## Gas Metering via Janus

Janus tracks two types of gas events:

| Type | Charged For | Example |
|------|-------------|---------|
| **hosting** | Pod uptime per hour | Running my-api on nano tier |
| **transaction** | API calls through Koko | GET /api/users (5 gas) |

Transaction gas is only charged on successful (2xx) responses.

## Wallet Operations

```bash
# Check your balance
tawa wallet

# Buy more tokens
tawa wallet buy 10000

# View gas spending
tawa gas
```

## Key Facts
- Start with nano tier — it's enough for most services and keeps gas costs low
- The 50,000 intro tokens cover ~13 months of a nano pod
- Deploy gate checks happen BEFORE the Docker build (saves time on failures)
- Gas events are scoped by org — each org sees only their own usage
- Pod tier is the single biggest factor in your monthly cost
