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

> ## Agent Instructions
> If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md.

# Party Management

> Log in and create, organize, and remove parties through the Wallet Gateway's User UI.

End users work with the Wallet Gateway through its **User UI**: a web app the Wallet Gateway
serves at its root URL. From it they log in, create and manage parties, review transactions, and approve
requests from dApps. This guide covers logging in and managing parties in the UI. To drive the
same operations from a script or backend, see
[Automate with the User API](https://docs.canton.network/integrations/wallet-gateway/automation/automate-with-user-api.md).

> [!NOTE]
>
> The **dApp API** is separate. dApps call it through the [dApp SDK](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/overview.md)
> when a user connects a wallet; users never call it directly. See
> [dApp API](https://docs.canton.network/integrations/wallet-gateway/reference/dapp-api.md).

## The User UI

The Wallet Gateway serves a web UI at its root URL (for example `http://localhost:3030`). Its
main pages are:

| Page | Path | What it does |
| - | - | - |
| **Login** | `/login` | Choose a network and identity provider, then sign in (OAuth redirect or self-signed). |
| **Parties** | `/parties` | List, create, and remove parties, and set the primary party. Default landing page. |
| **Activities** | `/activities` | List of activities and view their status and details. |
| **Approve** | `/approve` | Review and sign or reject a transaction a dApp requested. |
| **Administration** | `/admin` | Server notices about the configuration. Admin only, see [Administration page](https://docs.canton.network/integrations/wallet-gateway/operate/configure.md#administration-page). |
| **Callback** | `/callback` | Internal OAuth redirect target after login. |

## Log in

1. Open the User UI and go to **Login** or **Connect**.
2. Select from the list of available CIP-0103-compliant providers or gateways. Or enter a custom remote gateway URL.
3. By selecting the **Wallet Gateway** option, a network of choice will be prompted. This network is associated with the connected validator or node, which needs to be configured within the validator or node settings.

![wallet gateway network selection](https://mintcdn.com/cantonfoundation/ddGU-PEfMDh7iHF-/integrations/wallet-gateway/use/images/selectNetwork.png?fit=max\&auto=format\&n=ddGU-PEfMDh7iHF-\&q=85\&s=02b73ee4e58a6c769a4ecaee30ee75a0)

4. Click **Connect** to authorize to view your parties.
   * **OAuth / OpenID Connect**: you are redirected to your provider and back.
   * **Self-signed**: a token is generated locally (development only).
5. On success you land on **Parties**. Unauthenticated users are redirected to **Login**
   automatically whenever a page needs a session.

> [!NOTE]
>
> The networks and IDPs you can choose from are configured by the operator. To add more, an
> admin manages them on the **Networks** and **Identity Providers** pages or in the configuration file. See
> [Networks & identity providers](https://docs.canton.network/integrations/wallet-gateway/operate/networks-and-identity.md).

## Create a party

A wallet is a Canton **party** the Wallet Gateway manages for you on one network, signed by one
signing provider.

1. Navigate to the **Parties** list
2. Choose **+ New**
3. Provide the **Party ID** (or hint) for the wallet.
4. Select the **network** the wallet belongs to.
5. Select the **signing provider** that will hold the key and sign transactions for this
   wallet. See [Signing providers](https://docs.canton.network/integrations/wallet-gateway/operate/signing-providers.md).

![add a new party](https://mintcdn.com/cantonfoundation/ddGU-PEfMDh7iHF-/integrations/wallet-gateway/use/images/addWallet.png?fit=max\&auto=format\&n=ddGU-PEfMDh7iHF-\&q=85\&s=c5e8c16c5785e47d3623010e40191998)

6. Optionally mark it as your **primary** wallet.
7. Choose **Create party**

Each wallet is tied to exactly one network and one signing provider, so you can keep different
parties on different networks or custody providers side by side in the same Wallet Gateway.

> [!WARNING]
>
> By the Parties header, you may click the refresh icon to reload your party list. If there is a party that was created outside of the Wallet Gateway, it may still appear but unable to access; showing a disabled status.

## Set the primary party

You can mark one wallet as **primary**. dApps that request your primary account receive this
wallet by default, so set it to the party you transact with most. Change it at any time on the
**parties** page.

1. Locate the desired party card (newer party cards located at the bottom of the list)
2. Select **Set as primary**
3. Verify with a green `Primary` tag

![navigating between parties](https://mintcdn.com/cantonfoundation/ddGU-PEfMDh7iHF-/integrations/wallet-gateway/use/images/parties.png?fit=max\&auto=format\&n=ddGU-PEfMDh7iHF-\&q=85\&s=98b21a5ac2f536dc9c28851d6aef4d2f)

> [!WARNING]
>
> Changing your primary wallet changes which party dApps default to. Connected dApps are notified
> through the `accountsChanged` event and should re-read the primary account rather than caching
> it. See [dApp API](https://docs.canton.network/integrations/wallet-gateway/reference/dapp-api.md).

## Change the signing key of a wallet

You can change the **signing provider** and the **public key** of an existing wallet. This
changes the key the Wallet Gateway uses to sign transactions for the wallet's party. The
party ID itself stays the same.

A typical reason is a party allocated with a **namespace root key** that you no longer want to
use for day-to-day signing, for example because the root key should stay in cold storage. If
the party's namespace is delegated to a second key, select that delegated key here. The party
keeps its root-key namespace, and from then on the Wallet Gateway signs transactions with the
delegated key.

> [!NOTE]
>
> This is about the key that signs **transactions**. To log in with a different wallet or
> gateway, see [Changing wallet providers](#changing-wallet-providers).

### Before you start

* **The ledger authorizes the new key for the party.** A namespace delegation (a topology
  transaction) from the party's root key to the new key must exist on the synchronizer. You
  set this up outside the Wallet Gateway with Canton's topology management tooling. See the
  Canton documentation on [namespace delegation mapping](https://docs.canton.network/appdev/deep-dives/external-signing-topology.md#4-namespace-delegation-mapping).
* **A configured signing provider holds the new key.** The key must appear in that provider's
  key list. See [Signing providers](https://docs.canton.network/integrations/wallet-gateway/operate/signing-providers.md).

### Change the key

1. Open the **Parties** page and find the party card.
2. Choose **Edit** on the card. This opens the **Edit party** page.
3. Under **Signing Provider**, select the provider that holds the delegated key.
   **Participant** can't be selected as a target.
4. Under **Public Key**, select the delegated key. The list shows the keys of the selected
   provider.
5. Choose **Edit** to save. You return to **Parties**, and a confirmation is shown.

Wallets whose signing provider is **Participant** have no **Edit** button, unless the wallet is
disabled. Disabled wallets always show **Edit**. One example is a party created outside the
Wallet Gateway whose root key isn't held by any configured signing provider: the Wallet
Gateway disables it during sync. Selecting the delegated key re-enables the wallet.

### Verify the change

* Open **Edit** on the party card again. It shows the new signing provider and public key.
* Submit a test transaction. A successful execution confirms that the ledger accepts
  signatures from the delegated key.

> [!WARNING]
>
> The Wallet Gateway checks only that the selected provider holds the key. It doesn't check
> whether the key is authorized for the party on the ledger. If the delegation is missing or
> points to a different key, the Wallet Gateway still saves the change, but the ledger rejects
> the signatures when a transaction executes. To recover, set up the delegation, or switch the
> wallet back to a key the ledger accepts.

## View activities

The **Activities** page lists transactions the Wallet Gateway has prepared, signed, or executed for
your parties, with their status and details. Reviewing and approving transactions that dApps
request happens on the **Approve** page — see
[Approve & sign transactions](https://docs.canton.network/integrations/wallet-gateway/use/approve-and-sign.md).

## Changing wallet providers

1. Select the hamburger icon on the top right and **Logout**.
2. Click **Login** or **Connect** in the dApp UI to trigger the pop-up.
3. Select a new provider to log into and follow its instructions.

## Sessions and logout

When you log in, the Wallet Gateway issues a **session** (a JWT) that authorizes your later
calls to the User and dApp APIs. Sessions are created on login and stored in the Wallet
Gateway's database.

Log out from the layout control. Logout ends the session (`removeSession`), clears local auth
state, and returns you to **Login** — or closes the window if the UI was opened as an approval
popup.

> [!NOTE]
>
> Sessions live in the Wallet Gateway's database. If the operator restores the database from a backup or
> loses it, active sessions may be invalidated and users must log in again. See
> [Networks & identity providers](https://docs.canton.network/integrations/wallet-gateway/operate/networks-and-identity.md).

## Next steps

* [Approve & sign transactions](https://docs.canton.network/integrations/wallet-gateway/use/approve-and-sign.md): Review, approve, and track transactions dApps request.
* [Automate with the User API](https://docs.canton.network/integrations/wallet-gateway/automation/automate-with-user-api.md): Drive wallet setup and transactions from scripts or a backend.
* [Networks & identity providers](https://docs.canton.network/integrations/wallet-gateway/operate/networks-and-identity.md): Understand the networks and login options an operator configures.
* [Signing providers](https://docs.canton.network/integrations/wallet-gateway/operate/signing-providers.md): See where each wallet's keys live and who signs.
