Technical Architecture

Table of Content

Table of Content

Table of Content

Getting Started

Introductory guide to Stakefy’s architecture — understand how components interact on-chain and off-chain.

Stakefy’s core integration is the StakePay SDK and CLI, which let developers convert subscriptions into stake-based flows. The system is built on secure on-chain contracts (written in Rust/Anchor) and scalable APIs. Developers can use either the provided CLI or SDK libraries to interact with the StakePay protocol. For example, a stake transaction on Solana might use an Anchor program invoking the SPL Token program:

let cpi_accounts = TransferChecked {
    mint: ctx.accounts.mint.to_account_info(),
    from: ctx.accounts.user_token_account.to_account_info(),
    to: ctx.accounts.provider_stake_vault.to_account_info(),
    authority: ctx.accounts.user.to_account_info(),
};
let cpi_ctx = CpiContext::new(ctx.accounts.token_program.to_account_info(), cpi_accounts);
token_interface::transfer_checked(cpi_ctx, amount, ctx.accounts.mint.decimals)?;

This example (adapted from Anchor docs shows how tokens are transferred from a user’s wallet into a provider’s staking vault. In StakePay, such a transfer locks the user’s tokens on-chain, granting service access while the provider collects the staking yield.

Getting Started

  • Install prerequisites: Node.js, a Solana toolchain, and Rust/Anchor if building the on-chain program.

  • Install the Stakefy CLI/SDK:

    npm install -g @stakefy/cli   # or use yarn

    This provides commands like stakefy stake and imports the StakePay SDK for coding.


  • Configure your environment: Create a stakefy.config.json with your network settings and contract addresses (e.g. the StakePay program ID on Solana).

  • Deploy (if self-hosting): Use Anchor to build and deploy the StakePay program to a Solana network:

    anchor build
    anchor deploy


    The deployed program acts as the “payment rail” for staking-based transactions