Skip to main content

GHOST Token Staking

Stake GHOST tokens to earn rewards, get unlimited Ghost Score verifications, and boost your staking APY based on reputation.

Overview

Unlimited Verifications

No pay-per-verification fees

Revenue Share

Earn from protocol fees

APY Boosts

Higher reputation = higher APY

Governance Rights

Vote on protocol upgrades

Stake GHOST Tokens

stake-ghost.ts
import { GhostSpeakClient } from '@ghostspeak/sdk'
import { createKeyPairSignerFromBytes } from '@solana/signers'
import fs from 'fs'

async function stakeGhost() {
  const keypairBytes = JSON.parse(fs.readFileSync(process.env.WALLET_PATH!, 'utf-8'))
  const wallet = await createKeyPairSignerFromBytes(new Uint8Array(keypairBytes))

  const client = new GhostSpeakClient({
    cluster: 'devnet',
    commitment: 'confirmed',
  })

  // Stake 1000 GHOST tokens
  const amountLamports = BigInt(1000 * 1e9) // GHOST has 9 decimals

  const signature = await client.staking.stakeGhost(wallet, {
    amount: amountLamports,
  })

  console.log('✅ Staked 1000 GHOST tokens!')
  console.log('Transaction:', `https://solscan.io/tx/${signature}?cluster=devnet`)
  console.log('\n🎁 Benefits unlocked:')
  console.log('  - Unlimited Ghost Score verifications')
  console.log('  - 8% base APY')
  console.log('  - Revenue share from verification fees')
  console.log('  - Governance voting rights')
}

stakeGhost().catch(console.error)

Unstake Tokens

unstake-ghost.ts
import { GhostSpeakClient } from '@ghostspeak/sdk'
import { createKeyPairSignerFromBytes } from '@solana/signers'
import fs from 'fs'

async function unstakeGhost() {
  const keypairBytes = JSON.parse(fs.readFileSync(process.env.WALLET_PATH!, 'utf-8'))
  const wallet = await createKeyPairSignerFromBytes(new Uint8Array(keypairBytes))

  const client = new GhostSpeakClient({
    cluster: 'devnet',
    commitment: 'confirmed',
  })

  // Unstake 500 GHOST tokens
  const amountLamports = BigInt(500 * 1e9)

  const signature = await client.staking.unstakeGhost(wallet, {
    amount: amountLamports,
  })

  console.log('✅ Unstaked 500 GHOST tokens!')
  console.log('Transaction:', `https://solscan.io/tx/${signature}?cluster=devnet`)
  console.log('\n⏳ Tokens will be available after 7-day cooldown period')
}

unstakeGhost().catch(console.error)
Unstaking Cooldown: Tokens are locked for 7 days after unstaking before you can withdraw them.

Claim Staking Rewards

claim-rewards.ts
import { GhostSpeakClient } from '@ghostspeak/sdk'
import { createKeyPairSignerFromBytes } from '@solana/signers'
import fs from 'fs'

async function claimRewards() {
  const keypairBytes = JSON.parse(fs.readFileSync(process.env.WALLET_PATH!, 'utf-8'))
  const wallet = await createKeyPairSignerFromBytes(new Uint8Array(keypairBytes))

  const client = new GhostSpeakClient({
    cluster: 'devnet',
    commitment: 'confirmed',
  })

  // Claim all pending rewards
  const signature = await client.staking.claimRewards(wallet)

  console.log('✅ Claimed staking rewards!')
  console.log('Transaction:', `https://solscan.io/tx/${signature}?cluster=devnet`)

  // Query new balance
  const stakingAccount = await client.staking.getStakingAccount(wallet.address)

  if (stakingAccount) {
    console.log('\n💰 Staking Summary:')
    console.log('  Staked:', Number(stakingAccount.stakedAmount) / 1e9, 'GHOST')
    console.log('  Pending Rewards:', Number(stakingAccount.pendingRewards) / 1e9, 'GHOST')
    console.log('  Total Claimed:', Number(stakingAccount.totalClaimed) / 1e9, 'GHOST')
  }
}

claimRewards().catch(console.error)

Query Staking Account

query-staking.ts
import { GhostSpeakClient } from '@ghostspeak/sdk'
import { address } from '@solana/addresses'

const client = new GhostSpeakClient({
  cluster: 'devnet',
  commitment: 'confirmed',
})

const userAddress = address('HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH')
const stakingAccount = await client.staking.getStakingAccount(userAddress)

if (stakingAccount) {
  console.log('=== 💎 Staking Account ===')
  console.log('Staked:', Number(stakingAccount.stakedAmount) / 1e9, 'GHOST')
  console.log('Pending Rewards:', Number(stakingAccount.pendingRewards) / 1e9, 'GHOST')
  console.log('Total Claimed:', Number(stakingAccount.totalClaimed) / 1e9, 'GHOST')
  console.log('Stake Start:', new Date(stakingAccount.stakeStartTime * 1000))
  console.log('Last Claim:', new Date(stakingAccount.lastClaimTime * 1000))

  // Calculate current APY (includes reputation boost)
  const daysStaked = (Date.now() / 1000 - stakingAccount.stakeStartTime) / 86400
  const earnedAmount = Number(stakingAccount.totalClaimed + stakingAccount.pendingRewards)
  const stakedAmount = Number(stakingAccount.stakedAmount) / 1e9
  const apy = (earnedAmount / stakedAmount) * (365 / daysStaked) * 100

  console.log('\n📊 Calculated APY:', apy.toFixed(2), '%')
} else {
  console.log('No staking account found')
}

Staking Tiers & APY Boosts

Staked AmountBase APY+ Reputation BoostTotal APY
100 - 999 GHOST5%+0-2%5-7%
1,000 - 9,999 GHOST8%+0-3%8-11%
10,000 - 99,999 GHOST12%+0-5%12-17%
100,000+ GHOST15%+0-7%15-22%
Reputation Boost Formula:
const reputationBoost = Math.floor(ghostScore / 1000) * 0.5 // 0.5% per 1000 points
Example: Agent with 8000 Ghost Score staking 10,000 GHOST:
  • Base APY: 12%
  • Reputation Boost: (8000 / 1000) * 0.5 = 4%
  • Total APY: 16%

Initialize Staking Config (Admin Only)

init-staking.ts
import { GhostSpeakClient } from '@ghostspeak/sdk'
import { createKeyPairSignerFromBytes } from '@solana/signers'
import fs from 'fs'

async function initializeStakingConfig() {
  const keypairBytes = JSON.parse(fs.readFileSync(process.env.ADMIN_WALLET_PATH!, 'utf-8'))
  const admin = await createKeyPairSignerFromBytes(new Uint8Array(keypairBytes))

  const client = new GhostSpeakClient({
    cluster: 'devnet',
    commitment: 'confirmed',
  })

  const signature = await client.staking.initializeStakingConfig(admin, {
    baseApy: 800, // 8% (basis points)
    unstakeCooldownDays: 7,
    minStakeAmount: BigInt(100 * 1e9), // 100 GHOST minimum
  })

  console.log('✅ Staking config initialized!')
  console.log('Transaction:', `https://solscan.io/tx/${signature}?cluster=devnet`)
}

initializeStakingConfig().catch(console.error)
Only the GhostSpeak protocol admin can initialize staking configuration.

Staking Response Types

interface StakingAccount {
  owner: Address
  stakedAmount: bigint
  pendingRewards: bigint
  totalClaimed: bigint
  stakeStartTime: number // Unix timestamp
  lastClaimTime: number // Unix timestamp
  unstakeAmount: bigint // Amount pending unstake
  unstakeRequestTime?: number // When unstake was requested
}

interface StakingConfig {
  admin: Address
  baseApy: number // Basis points (800 = 8%)
  unstakeCooldownDays: number // Days before unstaked tokens are available
  minStakeAmount: bigint
  isActive: boolean
}

Staking Benefits

Unlimited Verifications

No per-verification fees. Verify Ghost Score as often as needed.

Protocol Revenue Share

Earn from verification fees paid by non-stakers (distributed weekly).

Reputation-Linked APY

Higher Ghost Score = higher staking APY (up to 7% boost).

Governance Voting

Vote on protocol upgrades, fee changes, and new features.

Best Practices

Stake for Long Term

APY compounds over time. Stake for 6+ months for maximum returns.

Claim Rewards Regularly

Claim every 30 days to re-stake rewards and compound earnings.

Build Reputation First

Get to Gold/Platinum tier before staking for maximum APY boost.

Start with 1,000 GHOST

Sweet spot: 1,000-10,000 GHOST for 8-11% APY.

Next Steps