> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crypto.westminister.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Multisig (Treasury/B2B)

> Registering Multisig Wallets and Completing High-Value B2B Transfers with Collaborative Signing

## Register a Multisig Wallet

`POST /api/v1/auth/multisig/wallets` (Vendor/Admin)

The platform supports **two registration styles**. The right option depends on your onboarding setup:

* **Platform-Managed Multisig** - The service provisions and operates the wallet according to your environment. You typically provide a label, network, and policy inputs as returned by onboarding. Follow the fields and enums your registration response documents.
* **Self-Managed (Bring-Your-Own Keys)** - You supply **`multisig_type`**, **`signer_addresses`**, **`threshold`**, and any network-specific addresses or URLs your integration package requires (Ethereum vs TRON differ).

## B2B Execution: Two Patterns

### Platform-Managed Multisig

For wallets fully operated inside EmaalCoin’s infrastructure, B2B transfers can **complete synchronously** (**`200`**) once internal approvals succeed. Settlement references and status on the **`transfers`** resource reflect what the platform records for tracking.

### Collaborative Signing (TRON/Ethereum)

For configurations that require co-signing on-chain:

1. **`POST /api/v1/auth/transfers/b2b`** may return **202** with **`proposal_id`**.
2. **`GET /api/v1/auth/multisig/proposals/{id}`** returns status and, for TRON, **`tron_unsigned_tx`** including **`rawDataHex`** and **`txID`**.
3. Authorized signers produce a **signature** over the agreed payload (commonly signing **`rawDataHex`** on TRON).
4. **`POST /api/v1/auth/multisig/proposals/{id}/confirm`** with `{ "signature": "<hex>" }`, or in controlled non-production environments optionally `{ "signer_private_key": "<hex>" }` for server-side signing on **TRON** only.

Signatures append until **`threshold`** is met. The service then **broadcasts** and updates linked **`transfers`** when `reference_type` is `transfer`.

## Ethereum (Gnosis Safe)

**`GET /api/v1/auth/multisig/proposals/{id}`** may return **`safe_tx_hash`**, **`safe_transaction_service_multisig_tx_url`**, **`ethereum_safe_draft`** (with **`propose_payload`**), and **`ethereum_first_confirm_requires_sender`**.

**`POST .../confirm`** always requires **`signature`**. **Never** send **`signer_private_key`** for Ethereum (the API rejects it). When **`ethereum_first_confirm_requires_sender`** is **true**, the first confirm must also include **`ethereum_sender`** (the Safe owner address that produced the EIP-712 signature for **`propose_payload`**). Later signers send **`signature`** only.

Execution can complete on-chain via a configured executor key or by polling the Safe Transaction Service after external execution.

## Security

Do not embed private keys in end-user apps. Prefer hardware or HSM signing and send **`signature`** only.
