# Bank — live container `taler-hacktivism-bank`

**Reflected from host koopa.**

| Item | Live |
|------|------|
| Container | **`taler-hacktivism-bank`** |
| Image | **`localhost/taler-hacktivism-banking:live`** |
| Ports | **9012** (API), **9013** (landing) |
| Site | `https://bank.hacktivism.ch` |

Config path in this repo: **`configs/taler-hacktivism-bank/`** (was `configs/taler-bank/`).  
Scripts: `scripts/taler-bank/`. Secrets: `koopa-admin-secrets/.../taler-bank/` → `/root/bank-*-password.txt`.

---

Image: `docker.io/library/debian:trixie` + package `libeufin-bank`  
Publish: **9012/tcp only**  
Labels: `org.hacktivism.service=taler-bank`, `host_port=9012`, `site=bank.hacktivism.ch`, `currency=GOA`

## Role

Regional **GOA Exploration Bank** for GNU Taler:

- **No IBAN**, no libeufin-nexus, no fiat conversion (`ALLOW_CONVERSION = no`)
- **`WIRE_TYPE = x-taler-bank`** (payto://x-taler-bank/bank.hacktivism.ch/…)
- Wallet default exchange: `https://exchange.hacktivism.ch/`
- Mobile withdraw: Bank SPA → login → **Withdraw** → Taler Wallet (QR / deeplink)

## Config layout (merchant/exchange pattern)

| Path in container | Mirror |
|-------------------|--------|
| `libeufin-bank.conf` | includes: `libeufin-bank.conf.includes.txt` |
| **`bank-overrides.conf`** | **`bank-overrides.conf`** |

## Manual start

| Path | User | Role |
|------|------|------|
| `/root/start_base_services_for_taler_bank.sh` | **root** | logs, postgres, DB ensure → shell as `libeufin-bank` |
| `/usr/local/bin/start_bank.sh` | **libeufin-bank** | start / `--restart` `libeufin-bank serve` |
| `/usr/local/bin/check_bank-health.sh` | any | health |

## Ports / Caddy

| Port | Role |
|------|------|
| 9012 | libeufin-bank HTTP (podman pasta) |
| 9001 | Caddy HTTPS `bank.hacktivism.ch` → 127.0.0.1:9012 |

**DNS:** A/AAAA for `bank.hacktivism.ch` → koopa public IP (required for TLS/ACME and phones).

## Accounts (typical)

| Login | Purpose |
|-------|---------|
| `admin` | bank admin (password on host `/root/bank-admin-password.txt`) |
| `exchange` | Taler exchange wire account (`is_taler_exchange`) |
| `explorer` | demo user for phone withdraw (`debit_threshold` = amount ceiling) |
| `DEFAULT_DEBT_LIMIT` | max overdraft for **new** accounts — set to libeufin ceiling `GOA:4503599627370496` (2026-07-16) |

Existing accounts need a one-shot admin `PATCH /accounts/$user` with
`{"debit_threshold":"GOA:4503599627370496"}` after raising the default (done live for all ~196 accounts).

## Mobile withdraw (GOA)

1. Install **GNU Taler Wallet** (Android / iOS / browser).
2. Open **https://bank.hacktivism.ch/** (after DNS + cert work).
3. Login as `explorer` (or registered user with debt headroom).
4. **Withdraw** → amount in GOA → open / scan with wallet.
5. Wallet uses `DEFAULT_EXCHANGE` = exchange.hacktivism.ch.

Exchange must have wire account pointing at this bank (payto + wire gateway credentials) and offline **enable-account** for `/keys` withdraw to fully work.

​**Details (diagram `/keys` ↔ Wire ↔ Account):**  
`configs/taler-exchange/README.md` → section **/keys, Wire and Account**.

## Public landing (withdraw QR)

English intro + QR: **`https://bank.hacktivism.ch/`** → `/intro/`  
Details: `configs/bank-landing/`. Refresh demo URI: `scripts/taler-bank/make-demo-withdraw-qr.sh`.

### Wallet says “transfer money” — auto-confirm

Normal Taler bank flow after the wallet selects the exchange:

1. Withdrawal status → **`selected`**
2. Bank must **`POST …/withdrawals/$ID/confirm`** → wires GOA user → exchange
3. Exchange **wirewatch** sees credit → wallet can finish withdraw

For the demo QR (`explorer`), automate step 2:

```bash
# once
/root/auto-confirm-withdrawals.sh
# loop (e.g. every 4s)
nohup /root/auto-confirm-withdrawals.sh --loop 2 >>/var/log/auto-confirm-withdrawals.log 2>&1 &
```

Script: `scripts/taler-bank/auto-confirm-withdrawals.sh`  
Watches IDs in `/var/www/bank-landing/withdraw.uri` and `withdraw-watch.ids`.