Integrate Para with Ethers.js (v5 or v6) to enable secure transaction signing while preserving the full Ethers API functionality.
Ethers.js is a library for interacting with Ethereum. This guide shows how to integrate Para’s secure signing with both v6 and v5 versions. Build transactions with Ethers API and sign them securely using Para.
To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration. Before integrating Para with your application, ensure you have:
Completed Para authentication setup in your application (see one of our Setup Guides)
A valid Para API key
An RPC endpoint for your desired network
Need an API key? Visit the Developer Portal to create API keys, manage billing, teams, and more.
import { ParaEthersSigner } from "@getpara/ethers-v6-integration";import { ethers } from "ethers";import Para, { Environment } from "@getpara/web-sdk";// Initialize Para (ensure authentication is completed before signing)const para = new Para(Environment.BETA, YOUR_API_KEY);// Set up the provider with a RPC URLconst provider = new ethers.JsonRpcProvider(YOUR_RPC_URL);// Create the Para Ethers Signerconst signer = new ParaEthersSigner(para, provider);// Now you can use the signer with any Ethers.js operations
Once you’ve set up the Para Ethers Signer, you can use it just like any standard Ethers signer. Para handles the secure signing process without changing how you construct transactions. An example of sending ETH and interacting with a smart contract is provided below.
// Construct a transaction using the standard Ethers APIconst transaction = {to: "0x1234567890123456789012345678901234567890",value: ethers.parseEther("0.01"),// Optional: specify gas parameters// gasLimit: 21000,};// Sign and send the transactionconst tx = await signer.sendTransaction(transaction);console.log("Transaction hash:", tx.hash);// Wait for confirmationconst receipt = await tx.wait();console.log("Transaction confirmed in block:", receipt.blockNumber);
// Contract ABI (simplified example for ERC-20 transfer)const abi = ["function transfer(address to, uint256 amount) returns (bool)"];// Contract address for your contractconst contractAddress = "0xTokenContractAddress";// Create a contract instance with your ParaEthersSigner passed as the signerconst contract = new ethers.Contract(contractAddress, abi, signer);// Call the contract method// Para will handle the signing process without modifying the transactionconst tx = await contract.transfer("0xRecipientAddress",ethers.parseUnits("10", 18) // Adjust decimals based on your token);console.log("Transaction hash:", tx.hash);
As long as the Para client is authenticated and has wallets available, you can use the full Ethers.js API with the Para Ethers Signer without any additional changes.
Returns the address of the wallet associated with this signer. By default the signer grabs the first EVM wallet associated with the authenticated user.
Signs EIP-712 typed data (for structured data signing).
Copy
Ask AI
const signature = await signer.signTypedData(domain, types, value);console.log("Typed Data Signature:", signature);
Para handles only the signing process. It does not modify your transaction in any way. All transaction construction, including gas estimations and parameter settings, is your responsibility through the Ethers.js API.
When working with the ParaEthersSigner, keep in mind:
Authentication requirement: The Para client must have an authenticated account before attempting any signing operations.
Wallet availability: Ensure Para has wallets available for the EVM wallet type. If you encounter errors about missing wallets, check your developer portal settings for your API key is configured for EVM wallet types.
Transaction construction: Para only signs the raw bytes of the transaction you provide. Any issues related to transaction parameters (gas price, gas limit, etc.) or RPC interactions are not related to Para’s signing functionality. The RPC endpoint or the transaction itself may be the source of any issues.
Network configuration: Make sure your RPC endpoint matches the network configuration in your Para setup. Ensuring you set the correct RPC URL to match the transaction Chain ID is crucial for successful transaction signing and submission.
Para’s signers can also be used on the server-side using pregen wallets or an active client side session. To learn more about using para on the server, check out these guides:
If your transaction fails with an RPC error, the issue is likely related to transaction construction, not Para’s signing process. Common causes include:
Insufficient funds for the transaction
Incorrect nonce value
Inadequate gas limit
RPC endpoint connectivity issues
Try constructing a simpler transaction first to verify the signing process works correctly.
If you receive an error about no wallets being available:
Ensure the user has completed Para’s authentication process
Verify the user has created or imported an Ethereum wallet
Check that you’re using the correct Para instance that was used during authentication
If signatures are not being verified correctly:
Check that you’re using the correct address from getAddress()
For EIP-712 typed data, ensure your domain and types match exactly between signing and verification
Verify that message formatting is consistent (some applications may prepend specific prefixes)
Now that you’ve completed signing transactions with Ethers.js, explore more advanced features like Permissions Popups. If you’re ready to kick off your project launch with Para, check out our Go Live Checklist.