# Solana USDC payment verifier

This is a dependency-free, read-only Python verifier for a single SPL-USDC
payment on Solana. It checks the recipient owner, exact integer token amount,
transaction failure status, confirmation status, and a configurable minimum
confirmation count. A bounded poll loop returns a structured timeout result
instead of waiting forever.

The verifier only calls Solana JSON-RPC `getSignatureStatuses` and
`getTransaction`. It never creates a key, signs a transaction, broadcasts a
transaction, or spends funds. Use a trusted RPC endpoint and pass only public
transaction data.

## CLI

```bash
python solana_usdc_verify.py \
  --rpc-url https://api.mainnet-beta.solana.com \
  --signature <TRANSACTION_SIGNATURE> \
  --recipient <RECIPIENT_WALLET> \
  --amount-usdc 1.25 \
  --min-confirmations 1 \
  --timeout 30
```

Exit status is `0` for a verified payment, `1` for a valid but unverified or
rejected payment, and `2` for invalid input or an RPC error. The JSON output
contains the observed amount in base units, confirmation count, slot, status,
and reason.

## Library

```python
from solana_usdc_verify import SolanaRpcClient, amount_to_units, verify_payment

result = verify_payment(
    SolanaRpcClient("https://api.mainnet-beta.solana.com"),
    signature="...",
    recipient="...",
    expected_amount_units=amount_to_units("1.25"),
    min_confirmations=1,
)
if result.verified:
    print("payment accepted")
```

The default mint is intentionally an explicit constant in the source; pass a
different `--mint` when verifying a devnet or another SPL token. Always check
the mint against the network and application configuration before accepting a
payment.

## Verify the bundle

```bash
python -m unittest -v test_solana_usdc_verify.py
sha256sum -c SHA256SUMS
```

The tests use a fake RPC client and contain no wallet, API key, personal data,
or network payment.
