# Register MPC Wallet

Finalise a completed DKG ceremony — Aurea verifies the address against the relay record and persists the wallet.

## Overview

Called by the browser after the DKG loop has converged. Aurea recomputes the public-key → address derivation from the broadcast shares posted to the relay, and only persists the wallet if it matches the address the client claims. This prevents a malicious client from registering an address it cannot actually sign for.

Once registered, the wallet behaves like any other Aurea wallet — it appears in `GET /v1/wallets/`, can be the primary wallet, and can be used as the source/destination in transactions and swaps.

### `POST /v1/mpc/wallets`

Authentication: bearer token required.

Address-verified registration of a wallet whose DKG ceremony has completed.

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `sessionId` | string | yes | sessionId returned by /dkg/start |
| `walletId` | string | yes | walletId returned by /dkg/start |
| `chain` | string | yes | Must match the chain passed to /dkg/start. A testnet's chain registry id (e.g. `polygon-amoy`) is stored under the family chain (`polygon`) on that testnet. |
| `curve` | string | no | Curve (default: secp256k1) |
| `address` | string | yes | 0x-prefixed address the engine derived locally |
| `label` | string | no | Friendly label for the wallet |

**Responses**

`201` Created

```json
{
  "id":        "mpc-wallet-uuid",
  "chain":     "base",
  "address":   "0xAbCd...",
  "label":     "Primary MPC",
  "walletType": "mpc",
  "isPrimary": false,
  "isTestnet": false,
  "created_at": "2026-06-12T10:00:00Z"
}
```

`409` Mismatch

```json
{ "error": "address does not match relay shares" }
```

## Implementation

```javascript
// After the DKG loop returns { address }
const wallet = await fetch('https://api.aureahub.com/v1/mpc/wallets', {
  method: 'POST',
  headers: { Authorization: `Bearer ${hubJwt}`, 'Content-Type': 'application/json' },
  body: JSON.stringify({
    sessionId,
    walletId,
    chain: 'base',
    address,                  // 0x… from the engine
    label: 'Primary MPC'
  })
}).then(r => r.json());
```

---

Web version: https://docs.aureahub.com/#mpc-wallet-register
