Para with Anchor Framework
Learn how to integrate Para with Solana Anchor Framework for interacting with on-chain programs.
The Anchor Frameworkis a popular development framework for building Solana programs that simplifies the development process with features like IDL integration and type safety. This guide will show you how to integrate Para’s wallet and signing capabilities with Anchor.
Prerequisites
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.
Installation
Choose your preferred package manager to install the required dependencies:
Setting Up Anchor with Para
To use Para with Anchor, you need to create a custom signer that integrates with Anchor’s wallet system. Below is an example of how to set up the Para signer with Anchor using the ParaSolanaWeb3Signer
class. You can reference the Para Solana Web3.js Integration guide for more details on the signer setup.
Creating a Read-Only Provider
For cases where you need to read from a program before the user has authenticated, you can create a read-only provider:
Working with Anchor Programs
Once you’ve set up the provider, you can initialize and interact with your Anchor program:
We encourage you check out the Anchor documentation for more details on how to define your IDL, accounts, and methods.
Para only acts as the signer for the transaction and does not handle the program logic or state. Constructing transactions and interacting with the program is entirely up to you. Ensure you have the correct program IDL and account structures defined in your Anchor program.
Server-Side Integration
Para’s signers can also be used on the server-side with Anchor using pregen wallets or an active client-side session. To learn more about using Para on the server, check out these guides:
Examples
If you’d like to learn more about how to use Para with Anchor for different program interactions, check out this example in our Examples Hub: