Skip to content

Solana Integration

Overview

This sample demonstrates how to integrate Openfort's embedded wallet infrastructure with the Solana blockchain. It showcases user creation, transaction execution on Solana, and cross-chain capabilities with EVM networks.

Project Structure

solana-sample/
├── src/
│   ├── App.tsx              # Main application component
│   ├── Login.tsx            # Authentication flow
│   ├── content.tsx          # UI content and components
│   ├── solana.tsx           # Solana blockchain interactions
│   ├── openfort.ts          # Openfort SDK configuration
│   └── assets/              # Static assets (logos, icons)
├── public/                  # Public assets
├── package.json             # Dependencies and scripts
└── README.md                # Project documentation

Key Features

  • Openfort embedded wallet creation
  • Solana transaction execution
  • Cross-chain support (Solana ↔ EVM chains)
  • Simple authentication flow
  • Chain switching capabilities
ComponentTechnology
FrontendReact + Vite
BlockchainSolana (+ Polygon Amoy for chain switching)
Key Libraries@openfort/openfort-js, @solana/web3.js
StylingTailwind CSS

Quick Start

Download the Solana sample using gitpick:

pnpx gitpick openfort-xyz/openfort-js/tree/main/examples/apps/solana-sample
cd solana-sample

This will download only the solana-sample directory without cloning the entire openfort-js monorepo.

Prerequisites

  • Node.js 18+
  • pnpm
  • Openfort account with configured API keys
  • Modern web browser

Configuration

  1. Copy the environment template:

    cp .env.example .env.local
  2. Add your Openfort credentials to .env.local:

    VITE_OPENFORT_PUBLIC_KEY=your_public_key_here
    

Install & Run

pnpm install
pnpm run dev

How It Works

The application demonstrates three core functionalities:

  1. User Creation: Creates a new Openfort user with embedded wallet support
  2. Solana Transactions: Executes transactions on the Solana blockchain using Openfort's signer
  3. Chain Switching: Demonstrates cross-chain capabilities by switching to Polygon Amoy (EVM chain)

This sample is ideal for developers looking to add Solana support to their applications while maintaining the flexibility to work with EVM-compatible chains.