> ## 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.

# Quickstart

> Install the dApp SDK and build a working wallet connection in a few minutes.

This is the shortest working integration: install the SDK, initialize it, let the user
connect a wallet, read their party, and submit a transaction. It uses only the high-level
SDK. You do not need the Provider API to build a dApp.

**1. Install the SDK**

> [tab] npm
>
> ```shell theme={"theme":{"light":"github-light","dark":"github-dark"}}
> npm install @canton-network/dapp-sdk
> ```

> [tab] yarn
>
> ```shell theme={"theme":{"light":"github-light","dark":"github-dark"}}
> yarn add @canton-network/dapp-sdk
> ```

> [tab] pnpm
>
> ```shell theme={"theme":{"light":"github-light","dark":"github-dark"}}
> pnpm add @canton-network/dapp-sdk
> ```

**2. Initialize on app load**

Call `init()` once, early in your app's lifecycle. This registers the default wallet
adapters and silently restores a previous session **without** opening the wallet picker.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import * as sdk from '@canton-network/dapp-sdk'

await sdk.init()
```

**3. Connect a wallet**

Call `connect()` in response to a user action (for example, a "Connect wallet" button).
This opens the wallet picker and runs the authentication flow.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
async function onConnectClick() {
    const result = await sdk.connect()
    console.log('Connected:', result.isConnected)
}
```

**4. Read the connected party**

Once connected, read the account the user marked as primary.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const account = await sdk.getPrimaryAccount()
console.log('Primary party:', account.partyId)
```

**5. Submit a transaction**

Use `prepareExecute()` to submit Daml commands. The SDK prepares the transaction, asks
the user to approve and sign it in their wallet, and submits it to the ledger.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const account = await sdk.getPrimaryAccount()

await sdk.prepareExecute({
    commands: [
        {
            CreateCommand: {
                templateId: '#canton-builtin-admin-workflow-ping:Canton.Internal.Ping:Ping',
                createArguments: {
                    id: `ping-${Date.now()}`,
                    initiator: account.partyId,
                    responder: account.partyId,
                },
            },
        },
    ],
})
```

> [!NOTE]
>
> This example uses the built-in `Ping` template to prove the round-trip works. For a real
> dApp, submit commands from your own Daml package. See
> [Parties & transactions](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/guides/parties-and-transactions.md) for details.

**6. Handle disconnect**

Let the user end their session.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
async function onDisconnectClick() {
    await sdk.disconnect()
}
```

## Next steps

* [Connect & Sessions](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/guides/connect-and-sessions.md) — Connect, restore sessions, check status, and disconnect.
* [Parties & Transactions](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/guides/parties-and-transactions.md) — Work with parties, sign messages, execute transactions, and query the ledger.
* [Wallet Discovery](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/guides/wallet-discovery.md) — Customize the wallet picker and add WalletConnect or custom remote wallets.
