Back to docs

Getting Started

Start building with Styx in 5 minutes

What is Styx Protocol?

Styx is a privacy-preserving Virtual State Layer for Solana. It provides two mainnet programs:

🔐 PMP - Private Memo Program

End-to-end encrypted messaging, private transfers, anonymous voting, and 19 instruction types for privacy-preserving applications.

🎁 WhisperDrop

Private token airdrops using Merkle trees. Distribute to 1M+ recipients while keeping the list completely private.

1

Install the SDK

Install the Styx SDK packages:

npm install @styx-stack/pmp-sdk @styx-stack/whisperdrop-sdk @solana/web3.js

Or with pnpm/yarn:

pnpm add @styx-stack/pmp-sdk @styx-stack/whisperdrop-sdk @solana/web3.js
2

Get an API Key

Generate an API key from your dashboard:

  1. 1.Connect your wallet
  2. 2.Go to Dashboard → API Keys
  3. 3.Click "Generate New Key"

⚠️ Keep your API key secure! Never commit it to version control.

3

Send Your First Message

Send an encrypted message using the PMP SDK:

import { Connection, Keypair, PublicKey } from '@solana/web3.js';
import { StyxPMP, encryptMessage, generateKeyPair } from '@styx-stack/pmp-sdk';

// Connect to Solana
const connection = new Connection('https://api.mainnet-beta.solana.com');
const pmp = new StyxPMP(connection);

// Your wallet
const sender = Keypair.fromSecretKey(/* your secret key */);
const recipient = new PublicKey('RECIPIENT_WALLET_ADDRESS');

// Generate encryption keys (X25519)
const encryptionKeys = generateKeyPair();

// Encrypt and send
const encrypted = encryptMessage(
  'Hello from Styx!',
  encryptionKeys.secretKey,
  recipientPublicKey
);

const signature = await pmp.sendPrivateMessage(
  sender,
  recipient,
  encrypted,
  { stealth: true }
);

console.log('✅ Message sent:', signature);
4

Create an Airdrop

Launch a private token airdrop with WhisperDrop:

import { 
  WhisperDrop, 
  buildMerkleTree, 
  generateCampaignId, 
  generateNonce 
} from '@styx-stack/whisperdrop-sdk';

const whisperdrop = new WhisperDrop(connection);

// Define recipients (kept private!)
const allocations = [
  { recipient: new PublicKey('wallet1...'), amount: 100n * 10n**9n, nonce: generateNonce() },
  { recipient: new PublicKey('wallet2...'), amount: 200n * 10n**9n, nonce: generateNonce() },
  // Add up to 1M+ recipients
];

// Build Merkle tree - only root goes on-chain
const campaignId = generateCampaignId();
const { root, proofs } = buildMerkleTree(campaignId, allocations);

// Create campaign (pays 0.01 SOL)
const { campaignPDA, escrowPDA } = await whisperdrop.initCampaign(
  authority,
  tokenMint,
  {
    campaignId,
    merkleRoot: root,
    expiryUnix: BigInt(Date.now() / 1000 + 86400 * 30),
  }
);

// Deposit tokens to escrow
await transferTokens(authorityATA, escrowPDA, totalAmount);

console.log('🎉 Airdrop created:', campaignPDA.toBase58());
console.log('📤 Share proofs with recipients to claim!');

Next Steps