Quickstart
Learn how to authenticate users, create embedded wallets, and send transactions in your NodeJS app
0. Prerequisites
This guide assumes you have followed the Server SDK setup guide to get a Privy client instance, privy
. If you have not already set up your Server SDK environment, go through those steps now.
1. Creating a wallet
First, we will create a server wallet. You will use this wallet’s id
in future calls to sign messages and send transactions.
2. Signing a message
Next, we’ll sign a plaintext message with the server wallet using the signMessage
method. Make sure to specify your wallet ID (not address) from creation in the input.
3. Sending transactions
In order to send a transaction, your wallet must have some funds to pay for gas. 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.
To send a transaction from your wallet, use the 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 chainId
values for the network you want to transact on. Also, input your recipient or smart contract address in the to
field.
Learn more about sending transactions.
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.