# Amount-ladder payment benchmark

## Model

| Side | Machine | Role |
|------|---------|------|
| **Drive (external)** | Local machine (this tree) | `taler-wallet-cli`, orchestration, CSV/RESULTS |
| **SUT (internal)** | koopa containers | merchant / exchange / bank under load |
| **Measure (internal)** | `ssh hernani@koopa` | `loadavg`, `ps` in each container |

```
[ Local-machine wallet-cli ] --HTTPS--> taler.hacktivism.ch / exchange / bank
       |                              ^
       | ssh sample_load              | pasta :9010/:9011/:9012
       v                              |
[ hernani@koopa ] --podman exec--> process CPU/RSS snapshots
```

## Prerequisites

1. Stack healthy (`check_*-health.sh` all green; public `/config` + exchange `/keys` 200).
2. Local wallet CLI (default path in script, override `MONO=`).
3. Secrets in **`../koopa-admin-secrets/koopa/host-root/`**:
   - `taler-bank/bank-admin-password.txt`
   - `taler-bank/bank-bench-fat-password.txt` (created if missing)
   - `taler-merchant/merchant-goa-demo-cp4zqk-password.txt`
4. SSH: `hernani@koopa` BatchMode, `podman` without su.

## Amount ladder (~20 payments: small / medium / large)

| Band | Amounts (GOA) |
|------|----------------|
| **small** | `0.000001` `0.00001` `0.0001` `0.001` `0.01` `0.05` `0.1` `0.5` |
| **medium** | `1` `2` `5` `10` `25` `50` `100` |
| **large** | `250` `500` `1000` `2500` `5000` |

Default list (20 steps):

```text
GOA:0.000001 GOA:0.00001 GOA:0.0001 GOA:0.001 GOA:0.01 GOA:0.05 GOA:0.1 GOA:0.5
GOA:1 GOA:2 GOA:5 GOA:10 GOA:25 GOA:50 GOA:100
GOA:250 GOA:500 GOA:1000 GOA:2500 GOA:5000
```

Σ ladder ≈ **GOA:9433** → default withdraw **GOA:50000**, admin credit **GOA:200000**.

Override: `AMOUNTS='GOA:1 GOA:10' ./run.sh`

## Pay-template URI (important)

Do **not** put a trailing slash after the template id (wallet then 404s).

```text
taler://pay-template/taler.hacktivism.ch/instances/goa-demo-cp4zqk/goa-free?amount=GOA:1
```

- Template `goa-free` is free-amount with fixed summary `"pay"` → pass **only** `amount=` (no `summary=` or merchant 409).
- HTTP GET probe:  
  `https://taler.hacktivism.ch/instances/goa-demo-cp4zqk/templates/goa-free` → 200.

## Run

```bash
cd koopa-admin-log/benchmarks/amount-ladder
./run.sh
# short:
AMOUNTS='GOA:0.05 GOA:1 GOA:10' WITHDRAW_AMT=GOA:100 ./run.sh
```

Outputs under `../../.tmp/amount-bench-<UTC>/`:

| File | Content |
|------|---------|
| `payments.csv` | per-amount timings + status |
| `RESULTS.md` | table summary |
| `koopa-load-*.out` | **inside** process samples |
| `run.log` | timeline |

## Columns (RESULTS)

- **handle**: wall time of `wallet handle-uri`
- **run-until-done**: wallet background after handle
- **total**: sum
- **loadavg**: koopa 1‑min load after payment
- **status**: `paid` / `error` / `insufficient` / …

## Related

- Partial earlier run (wrong URI): `2026/2026-07-09--amount-ladder-partial-results.md`
- Instance notes: `configs/taler-hacktivism/demo-instance-goa-demo-cp4zqk.md`
