Skip to main content

0. Prerequisites

This guide assumes the setup guide is complete and a Privy client instance named client is available.

1. Creating a wallet

First, create a wallet. The wallet’s id is used in future calls to sign messages and send transactions.
Learn more about creating wallets.
Errors raised by the SDK inherit from PrivyAPIError. Catch APIStatusError for non-success API responses or a more specific subclass such as RateLimitError, BadRequestError, or NotFoundError. Catch APIConnectionError for network-level failures.

User wallets

Create a non-custodial user wallet by first creating a user, then provisioning a wallet for that user.
When creating a user wallet, specify the user ID as the owner of the wallet. Obtain a user ID by first creating a user.Alternatively, create a user and wallet at the same time by passing wallets to client.users.create.

2. Signing a message

Next, sign a plaintext message with the wallet using a chain-specific helper. Specify the wallet ID (not its address) from creation.
Learn more about signing messages on Ethereum and Solana.

3. Sending transactions

The wallet must have funds to send a transaction. Use a testnet faucet to test transacting on a testnet (for example, Base Sepolia), or send funds to the wallet on the network of your choice.
Use a chain-specific transaction method to send a transaction. The SDK populates missing network-related values, signs the transaction, broadcasts it to the network, and returns the transaction hash. Specify the wallet id from wallet creation and the caip2 chain ID for the target network.
Learn more about sending transactions on Ethereum and Solana.
For more control, prepare and broadcast the transaction independently, and use client.wallets.ethereum.sign_transaction for EVM or client.wallets.solana.sign_transaction for Solana.

4. Creating a user

To create a user independently of the user-wallet flow above, call create on the users service and pass the linked accounts to associate with the user.
Learn more about creating users, and see the pregenerating wallets guide for linking wallets to users before they sign in.

Next steps

Authorization keys

Add an extra layer of security by signing requests with authorization keys.

Policies

Restrict what wallets can do with configurable policies.

Idempotency keys

Prevent duplicate transactions with idempotency key support.

Quorum approvals

Require multiple parties to approve before sending a transaction.