Skip to main content
While signing must happen on the client (where the wallet lives), you can significantly speed up your app by performing the simulation and argument building on the server. This reduces the number of RPC calls the browser has to make and keeps your contract specifications off the main thread.

The Workflow

    1. Server: Fetch the contract spec and build the transaction.
    1. Server: Run the simulation to calculate fees.
    1. Client: Receive the “ready-to-sign” transaction from the server.
    1. Client: Sign with the user’s wallet and broadcast.

The Server Action

The Client Component

Performance Gains

  • Reduced Client Latency: The browser doesn’t need to fetch the WASM spec or run heavy simulations.
  • Security: You can validate the user’s input on the server before the transaction is even sent to the wallet.
  • Shared Logic: If you are already fetching data for SEO (SSR), you can reuse that contract state for the subsequent user actions.