> ## 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 Wallet SDK, connect it to a validator, and create your first external party.

This is the shortest working path with the Wallet SDK: install it, connect to a validator, and create an external party. The example runs against a local validator. To use DevNet, TestNet or MainNet, change the configuration as described in [Configuration](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration.md).

## Prerequisites

* Node.js. The SDK currently supports NodeJS environments only.
* A running Canton validator. [Splice LocalNet](https://docs.canton.network/sdks-tools/development-tools/localnet.md) is convenient for development and testing, but DevNet, TestNet and MainNet validators work as well.

## Install the SDK

The Wallet SDK is available as a package on the NPM registry. Install it with your preferred package manager.

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

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

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

To build only a dApp, the [dApp SDK](https://docs.canton.network/sdks-tools/sdks/dapp-sdk/quickstart.md) can be used instead. It has a smaller bundle size and is optimized for browser usage. Both SDKs use the same underlying core packages. Where only part of the code is needed, for example transaction visualization or hash verification, those packages can be used independently.

## Connect and create a party

Create the SDK with an auth configuration and the URL of the ledger API, generate a key pair, and create the party. An external party is controlled by a key pair: its ID is made of a hint and the fingerprint of the public key. The SDK creates the party's topology transactions, signs them with the private key, and submits them.

```typescript theme={"theme":{"light":"github-light","dark":"github-dark"}}
import {
    SDK,
    type TokenProviderConfig,
    localNetStaticConfig,
} from '@canton-network/wallet-sdk'

export default async function () {
    const auth: TokenProviderConfig = {
        method: 'self_signed',
        issuer: 'unsafe-auth',
        credentials: {
            clientId: 'ledger-api-user',
            clientSecret: 'unsafe',
            audience: 'https://canton.network.global',
            scope: '',
        },
    }

    /*
    if using OAuth, provide a different auth config when initializing the SDK such as:
        const auth = {
        method: 'client_credentials',
        configUrl: 'https://my-oauth-url',
        credentials: {
            clientId: 'your-client-id',
            clientSecret: 'your-client-secret',
            audience: `https://daml.com/jwt/aud/participant/${participantId}`,
            scope: 'openid daml_ledger_api offline_access',
        },
    }
    */

    const sdk = await SDK.create({
        auth,
        ledgerClientUrl: localNetStaticConfig.LOCALNET_APP_USER_LEDGER_URL,
        synchronizerId: global.LOCALNET_GLOBAL_SYNCHRONIZER,
    })

    const key = sdk.keys.generate()

    // partyHint is optional but recommended to make it easier to identify the party
    const partyHint = 'my-wallet-1'

    await sdk.party.external
        .create(key.publicKey, { partyHint })
        .sign(key.privateKey)
        .execute()
}
```

* `auth` tells the SDK how to get an access token. `self_signed` is for local development only. For a real validator use OAuth (`client_credentials`), as shown in the commented block and in [Configuration](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration.md).
* `localNetStaticConfig` holds the default endpoints of a Splice LocalNet.
* `sdk.keys.generate()` creates the key pair. Keep the private key safe: it signs everything the party does.
* The `partyHint` makes the party easier to recognize. It is optional but recommended.

## Next steps

* [Creating an External Party](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/creating-an-external-party.md): the same flow step by step, with key pairs, fingerprints and topology transactions.
* [Configuration](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration.md): connect to other environments and use other authentication methods.
* [Preparing and Signing a Transaction](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/preparing-and-signing-a-transaction.md): submit your first transaction.
* [Transfer Types](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/guides/transfer-types.md): one-step and two-step transfers.
* [v0 to v1 Migration Guide](https://docs.canton.network/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration.md): if you used the earlier controller-based SDK.
