Quickstart Guide

Get started with Inkognito Network in under 5 minutes.

Installation

Complete Example
1npm install @inkognito/client

Basic Usage

1. Create a Commitment

First, generate a secret commitment. This is your privacy key:

Complete Example
1import { ZKProofGenerator } from '@inkognito/client';
2
3// Generate a random commitment (keep this secret!)
4const commitment = ZKProofGenerator.generateRandomCommitment();
5
6// Save this commitment securely
7console.log('Your commitment:', commitment.toString());
8// Example output: 12345678901234567890123456789012345678901234567890

⚠️ Important: Store your commitment securely! You'll need it to access your credits.

2. Initialize the Client

Complete Example
1import { InkognitoClient } from '@inkognito/client';
2
3const client = new InkognitoClient({
4  endpoint: 'https://rpc.inkognito.network',
5  mode: 'zk', // Use zero-knowledge proofs
6  commitment: commitment, // Your secret commitment
7  wasmPath: './circuits/payment_proof.wasm',
8  zkeyPath: './circuits/payment_proof_final.zkey',
9});

3. Buy Credits

Use the playground to purchase credits:

  1. Connect your Phantom wallet
  2. Click "Buy Credits"
  3. Enter the amount (minimum 0.0001 SOL)
  4. Confirm the transaction
  5. Your credits are now live on-chain!

Alternatively, use the SDK:

Complete Example
1import { Connection, PublicKey, Transaction } from '@solana/web3.js';
2
3// This example shows the manual process
4// In production, use the playground or build your own UI
5
6const connection = new Connection('https://api.devnet.solana.com');
7// ... build deposit transaction ...
8// See Integration Guide for full code

4. Make Anonymous RPC Calls

Complete Example
1// Get blockchain height
2const height = await client.request('getBlockHeight');
3console.log('Current height:', height);
4
5// Get your balance anonymously
6const balance = await client.request('getBalance', [YOUR_WALLET_ADDRESS]);
7console.log('Balance:', balance.value / 1e9, 'SOL');
8
9// Get account info
10const accountInfo = await client.request('getAccountInfo', [ACCOUNT_ADDRESS]);
11console.log('Account:', accountInfo);
12
13// Get recent transactions
14const signatures = await client.request('getSignaturesForAddress', [
15  ADDRESS,
16  { limit: 10 }
17]);
18console.log('Recent transactions:', signatures);

Complete Example

Complete Example
1import { InkognitoClient, ZKProofGenerator } from '@inkognito/client';
2
3async function main() {
4  // 1. Setup (one-time)
5  const commitment = ZKProofGenerator.generateRandomCommitment();
6
7  // 2. Initialize client
8  const client = new InkognitoClient({
9    endpoint: 'https://rpc.inkognito.network',
10    mode: 'zk',
11    commitment: commitment,
12    wasmPath: './circuits/payment_proof.wasm',
13    zkeyPath: './circuits/payment_proof_final.zkey',
14  });
15
16  // 3. Buy credits (via playground or your own UI)
17  console.log('Go to https://inkognito.network/playground to buy credits');
18  console.log('Use this commitment:', commitment.toString());
19
20  // 4. Make RPC calls
21  try {
22    // Check Solana version
23    const version = await client.request('getVersion');
24    console.log('Solana version:', version);
25
26    // Get current slot
27    const slot = await client.request('getSlot');
28    console.log('Current slot:', slot);
29
30    // Check session state
31    const session = client.getSession();
32    console.log('Requests remaining:', session?.requestsRemaining);
33  } catch (error) {
34    if (error.name === 'PaymentRequiredError') {
35      console.log('Payment required! Go buy credits.');
36      console.log('Invoice:', error.invoice);
37    } else {
38      console.error('Error:', error.message);
39    }
40  }
41}
42
43main();

Download ZK Circuits

The ZK proof generation requires circuit files. Download them:

Complete Example
1# Download from our CDN
2curl -O https://cdn.inkognito.network/circuits/payment_proof.wasm
3curl -O https://cdn.inkognito.network/circuits/payment_proof_final.zkey
4
5# Or from GitHub releases
6wget https://github.com/InkognitoLabs/inkognito-network/circuits/releases/latest/download/payment_proof.wasm
7wget https://github.com/InkognitoLabs/inkognito-network/circuits/releases/latest/download/payment_proof_final.zkey

Or use our hosted version (no download needed):

Complete Example
1const client = new InkognitoClient({
2  endpoint: 'https://rpc.inkognito.network',
3  mode: 'zk',
4  commitment: commitment,
5  // Use CDN-hosted circuits
6  wasmPath: 'https://cdn.inkognito.network/circuits/payment_proof.wasm',
7  zkeyPath: 'https://cdn.inkognito.network/circuits/payment_proof_final.zkey',
8});

Pricing

  • Price per credit: 10,000 lamports (0.00001 SOL)
  • 1 credit = 100 RPC requests (session-based)
  • Example: 0.001 SOL = 100 credits = 10,000 requests

Next Steps

Need Help?