# WalletConnect Companion Contract

This document describes the wallet side of version 1.2.0. A PS5 or web
companion is a separate dapp and must create the WalletConnect v2 URI, display
its QR, request only approved methods, verify responses, authorize products,
and fulfill purchases server-side.

## Chains

- Ethereum: `eip155:1`
- Bitcoin: `bip122:000000000019d6689c085ae165831e93`

Cross-chain requests are rejected.

## Ethereum

`eth_sendTransaction` accepts one JSON-RPC transaction object. `from` must be
the connected account, `to` must be a mainnet address, `value` is a hex wei
quantity, and `data` or `input` may contain contract calldata. Contract
creation is not supported. If `chainId` is included, it must resolve to 1.

The wallet estimates gas, enforces a 2,000,000 gas cap, calculates the USD 4.99
service amount from a fresh ETH/USD quote, presents all values, and requires a
fresh strong biometric. A successful response is the recipient transaction
hash. The separately signed service transaction is recoverable if its initial
broadcast is interrupted.

## Bitcoin

`sendTransfer` parameters are:

```json
{
  "account": "bc1...",
  "recipientAddress": "bc1...",
  "amount": "10000"
}
```

`amount` is satoshis. The wallet calculates a fresh USD 4.99 service output,
adds the miner fee and change, presents the full review, and signs one atomic
transaction after strong biometric confirmation. A successful response is:

```json
{"txid":"..."}
```

## Device Proof

Request `gtavi_validateDevice` on the selected chain with:

```json
{"nonce":"at-least-16-characters-and-never-reused"}
```

The result contains a signed payload, signature algorithm, ECDSA signature,
Android attestation certificate chain, hardware security level, and app
signing-certificate SHA-256. The payload expires after two minutes.

The remote verifier must validate the certificate chain and Android attestation
extension against trusted roots, the challenge and key properties, package and
APK signing certificate, payload signature, chain, origin, session topic,
wallet address, expiry, and one-time nonce. It must reject software-only keys if
the product policy requires hardware-backed identity.

## Product Authorization

Wallet settlement does not prove game ownership or product delivery. The
companion backend must bind the WalletConnect session to an authenticated user
and device, create a unique order, verify blockchain settlement and amount,
prevent replay or duplicate fulfillment, and only then grant the product.
