The Para Server SDK enables secure server-side blockchain operations across different JavaScript runtime environments.
With nearly identical functionality to client-side implementations, the server SDK allows you to perform signing
operations server-side by either importing client-side sessions or using pregenerated wallets.
Installation
Install the Para Server SDK in your preferred JavaScript runtime environment:
npm install @getpara/server-sdk@alpha --save-exact
Initialization
Initialize the Para Server SDK with your API key. The initialization process varies slightly depending on your runtime
environment:
import { Para as ParaServer } from "@getpara/server-sdk@alpha";
// Standard initialization for Node.js
const paraServer = new ParaServer("YOUR_API_KEY");
Authentication Methods
After initializing the Para Server SDK, you need to authenticate it before performing any operations. The server SDK
supports two authentication methods:
Option 1: Importing Client Sessions
Import an active session from your client application to create a server-side replica that can perform the same
operations.
First, in your client application, export the active session to get a serialized string:
// Client-side
const serializedSession = await para.exportSession();
// Send this string to your server endpoint
This serialiazed sessions tring can then be sent to your server via an API endpoint or any other secure method.
If signing on the server isn’t required, you can pass { excludeSigners: true }
as an argument to exportSession
to remove the signer data from the exported wallets:await para.exportSession({ excludeSigners: true });
before sending it to your server.
Then, on your server, import the serialized session to create a functional server-side client:
// Server-side
await paraServer.importSession(serializedSession);
With a session no loaded into the para server instance, you can now perform all operations that the Para Server SDK supports.
Option 2: Using Pregenerated Wallets
Generate and use deterministic wallets server-side without requiring client-side authentication. This pregen wallet will load the para server instance with a wallet that can be used for all operations that the Para Server SDK supports.
import { WalletType } from "@getpara/server-sdk@alpha";
await paraServer.createPregenWallet({
type: 'EVM', // or 'SOLANA', 'COSMOS'
pregenId: { email: "user@example.com" },
});
When using pregenerated wallets, you’ll need to manage the user share of the wallet and store it securely.
Learn more about pregen wallets and their usage on the server in our pregen wallets guide.
Pregenerated Wallets Guide
Examples
Explore our example implementations of the Para Server SDK across different runtime environments:
Troubleshooting
If you encounter issues while setting up the Para Server SDK, check out our troubleshooting guide:
Next Steps
Once your Para Server SDK is set up and authenticated, you can start performing blockchain operations. The server SDK
provides the same functionality as the client SDK, allowing you to: