Para Server SDK provides seamless integration with Ethereum Virtual Machine (EVM) compatible chains through popular libraries like Ethers.js and Viem. Once youโve set up and authenticated your Para Server client, the EVM integration works identically to the client-side implementation.
Before using these integrations, ensure youโve completed the server setup by importing a client session or creating a pregenerated wallet. See the Server Setup Guide for details.
Installation
Install the required dependencies for your preferred EVM library:
npm install @getpara/ethers-v6-integration ethers
Implementation
Ethers.js Integration
The Para Ethers Signer acts as a drop-in replacement for standard Ethers signers:
import { Para as ParaServer, Environment } from "@getpara/server-sdk";
import { ParaEthersSigner } from "@getpara/ethers-v6-integration";
import { ethers } from "ethers";
// Para server client (already authenticated)
const paraServer = new ParaServer(Environment.BETA, "YOUR_API_KEY");
// Set up the provider with your RPC URL
const provider = new ethers.JsonRpcProvider("YOUR_RPC_URL");
// Create the Para Ethers Signer
const signer = new ParaEthersSigner(paraServer, provider);
// Now you can use the signer with any Ethers.js operations
const balance = await provider.getBalance(await signer.getAddress());
console.log(`Balance: ${ethers.formatEther(balance)} ETH`);
// Sign a message
const signature = await signer.signMessage("Hello from Para Server!");
// Send a transaction
const tx = await signer.sendTransaction({
to: "0xRecipientAddress",
value: ethers.parseEther("0.001")
});
Viem Integration
Paraโs Viem integration provides a custom Viem client compatible with all Viem operations:
import { Para as ParaServer, Environment } from "@getpara/server-sdk";
import { createParaAccount, createParaViemClient } from "@getpara/viem-integration";
import { http } from "viem";
import { sepolia } from "viem/chains";
// Para server client (already authenticated)
const paraServer = new ParaServer(Environment.BETA, "YOUR_API_KEY");
// Create a Para Account
const account = await createParaAccount(paraServer);
// Create the Para Viem WalletClient
const walletClient = createParaViemClient(paraServer, {
account: account,
chain: sepolia,
transport: http("https://ethereum-sepolia-rpc.publicnode.com"),
});
// Now you can use the walletClient with any Viem operations
const hash = await walletClient.sendTransaction({
to: "0xRecipientAddress",
value: 1000000000000000n // 0.001 ETH
});
Best Practices
- Use environment variables for API keys and RPC URLs
- Implement proper error handling for network failures
- Consider gas price management for production applications
- Cache network calls where appropriate to reduce RPC usage
Learn More
For detailed examples of using Para with EVM chains, including smart contract interactions, ERC-20 transfers, and more, refer to our web documentation:
Examples
Explore our server-side EVM integration examples: