EVM Integration
Integrate Para with EVM-compatible chains in your Flutter applications
Introduction
This guide demonstrates how to integrate Para with Ethereum Virtual Machine (EVM) compatible blockchains in your Flutter applications. Para acts as a secure signer for your transactions, while Web3Dart handles the blockchain interactions.
Para’s approach to EVM transaction signing is designed for flexibility and security:
- Para signs the raw transaction bytes without modifying the transaction data
- Your application maintains full control over transaction construction
- Para never has access to your application’s blockchain RPC endpoints
Prerequisites
Before you begin, ensure you have:
- Para SDK set up in your Flutter project (see the Setup Guide)
- A user authenticated with Para
- Web3Dart package installed in your project
Use version ^2.7.3
of Web3Dart to ensure compatibility with Para’s EVM signer.
Setting Up the Para EVM Signer
The Para SDK provides an EVM signer that implements interfaces compatible with Web3Dart. First, let’s create a signer and connect it to Web3Dart:
Signing Transactions
Para acts as the underlying signer, taking the serialized version of the transaction data and signing the raw bytes. Para never modifies the transaction data, which means your application is responsible for properly constructing transactions.
EIP-1559 Transaction
EIP-1559 transactions are the recommended format for most modern EVM chains, offering more predictable gas fees:
Interacting with Smart Contracts
Para can also sign transactions that interact with smart contracts:
Error Handling
When working with Para and EVM transactions, you might encounter several types of errors:
- Para Signing Errors: Occur when Para cannot sign the transaction (e.g., user cancels or verification fails)
- Transaction Formation Errors: Occur when the transaction is improperly formed
- RPC Errors: Occur when the blockchain node rejects the transaction
Best Practices
When using Para with EVM chains:
- Always verify transaction data before signing: Para signs whatever you provide, so ensure transaction data is correct
- Keep RPC endpoints secure: Never expose your RPC endpoints in client-side code
- Estimate gas properly: Always estimate gas and add a buffer to avoid transaction failures
- Handle nonce management: Track nonces carefully, especially for high-frequency transaction applications
- Test on testnets first: Always test your integration on testnets before moving to mainnet
Multi-Chain Support
Para’s EVM signer works with any EVM-compatible chain. To support multiple chains, simply change the RPC endpoint in your Web3Client:
Example
For an example on using Para with EVM in Flutter, check out this evm_sign_example.dart in our examples repository:
Additional Resources
For more information on Web3Dart usage, refer to the Web3Dart documentation: