This guide is for the
@privy-io/node library. If you are looking for the deprecated
@privy-io/server-auth library, please see the
NodeJS guide.0. Prerequisites
This guide assumes that you have completed the Setup guide, to get a Privy client instance,privy.
1. Creating a wallet
First, we will create a wallet. You will use this wallet’sid in future calls to sign messages and send transactions.
- Ethereum
- Solana
When using the
PrivyClient to work with the API, all errors thrown will be instances of
APIError or PrivyAPIError. You should catch these errors and handle them accordingly, using
the error’s status, name and message.User wallets
You can create a self-custodial user wallet using the SDK. First, create a user, then provision a wallet for that user.- Ethereum
- Solana
If you are creating a user wallet, you must specify the user ID as the owner of the wallet. You can obtain a user ID by first creating a user before creating the wallet.Or, you can create a user and wallet at the same time.
2. Signing a message
Next, we’ll sign a plaintext message with the wallet using thesignMessage method.
Make sure to specify your wallet ID (not address) from creation in the input.
- Ethereum
- Solana
3. Sending transactions
Your wallet must have some funds in order to send a transaction. You can use a testnet
faucet to test transacting on a testnet (e.g. Base Sepolia)
or send funds to the wallet on the network of your choice.
sendTransaction method.
It will populate missing network-related values (gas limit, gas fee values, nonce, type), sign your
transaction, broadcast it to the network, and return the transaction hash to you.
In the request, make sure to specify your wallet id from your wallet creation above, as well as
the caip2 chain ID and chain_id values for the network you want to transact on.
Also, input your recipient or smart contract address in the to field.
- Ethereum
- Solana
4. Creating a user
To create a user for your application, you can use thecreate method, passing in
a UserCreateRequestBody object, which allows you to specify the linked accounts, custom metadata,
and wallets that should be associated with said user.
Next steps & advanced topics
- For an additional layer of security, you can choose to sign your requests with authorization keys.
- To restrict what wallets can do, you can set up policies.
- To prevent double sending the same transaction, take a look at our support for idempotency keys.
- If you want to require multiple parties to sign off before sending a transaction for a wallet, you can accomplish this through the use of quorum approvals.

