Use Para Server SDK with Ethereum and EVM-compatible chains
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 for details.
The Para Ethers Signer acts as a drop-in replacement for standard Ethers signers:
Copy
Ask AI
import { Para as ParaServer } from "@getpara/server-sdk@alpha";import { ParaEthersSigner } from "@getpara/ethers-v6-integration@alpha";import { ethers } from "ethers";// Para server client (already authenticated)const paraServer = new ParaServer("YOUR_API_KEY");// Set up the provider with your RPC URLconst provider = new ethers.JsonRpcProvider("YOUR_RPC_URL");// Create the Para Ethers Signerconst signer = new ParaEthersSigner(paraServer, provider);// Now you can use the signer with any Ethers.js operationsconst balance = await provider.getBalance(await signer.getAddress());console.log(`Balance: ${ethers.formatEther(balance)} ETH`);// Sign a messageconst signature = await signer.signMessage("Hello from Para Server!");// Send a transactionconst tx = await signer.sendTransaction({ to: "0xRecipientAddress", value: ethers.parseEther("0.001")});
Para’s Viem integration provides a custom Viem client compatible with all Viem operations:
Copy
Ask AI
import { Para as ParaServer } from "@getpara/server-sdk@alpha";import { createParaAccount, createParaViemClient } from "@getpara/viem-integration@alpha";import { http } from "viem";import { sepolia } from "viem/chains";// Para server client (already authenticated)const paraServer = new ParaServer("YOUR_API_KEY");// Create a Para Accountconst account = await createParaAccount(paraServer);// Create the Para Viem WalletClientconst walletClient = createParaViemClient(paraServer, { account: account, chain: sepolia, transport: http("https://ethereum-sepolia-rpc.publicnode.com"),});// Now you can use the walletClient with any Viem operationsconst hash = await walletClient.sendTransaction({ to: "0xRecipientAddress", value: 1000000000000000n // 0.001 ETH});
For detailed examples of using Para with EVM chains, including smart contract interactions, ERC-20 transfers, and more, refer to our web documentation: