Skip to main content
Integrate Para’s embedded wallets with Porto to combine Para’s authentication and key management with Porto’s smart account features. The usePortoSmartAccount hook handles the entire upgrade flow — wrapping the Para signer, registering admin keys, and submitting the upgrade to Porto’s relay — so you can focus on your application logic.

What You Get

Integration Pattern

Para handles:
  • Authentication (social login, email, SMS)
  • Key custody (MPC security)
  • Cross-app identity
  • Raw message signing
Porto handles:
  • Smart account operations (EIP-7702)
  • Transaction batching
  • Gas sponsorship
  • Session key management

Prerequisites

Installation

Setup Para Provider

Configure the Para provider:

Gas Sponsorship

On testnets, Porto’s relay sponsors gas by default — no configuration needed. For mainnet, you must set up a Porto merchant account to cover gas fees for your users:
  1. Run pnpx porto onboard --admin-key to create a merchant account
  2. Deploy a server-side merchant route using porto/server
  3. Pass your endpoint URL as merchantUrl in the hook config

Usage

Use the usePortoSmartAccount hook to create and manage a Porto smart account. The hook handles Para signer creation, admin key registration, EOA upgrade, and Porto relay configuration internally.

Accessing the Porto Client Directly

For advanced use cases like session key management, access the underlying Porto client:

How It Works

The usePortoSmartAccount hook performs these steps internally:
  1. Resolves the Para wallet — finds the user’s EVM wallet address
  2. Creates a viem account — wraps the Para signer for raw ECDSA signing
  3. Connects to Porto’s relay — creates a client pointed at https://rpc.porto.sh
  4. Registers an admin key — creates a secp256k1 admin key from the Para signer
  5. Upgrades the EOA — submits a 7702 delegation via prepareUpgradeAccount + upgradeAccount
  6. Returns a unified SmartAccount — with sendTransaction, sendBatchTransaction, and access to the underlying Porto client

Next Steps