A Solana smart contract for decentralized content monetization through token staking.
Program ID: 6HW8dXjtiTGkD4jzXs7igdFmZExPpmwUrRN5195xGup
Users stake ACCESS tokens into content publisher pools (StakePool) via their StakeAccount to access content. Token inflation rewards are distributed to stakers and publishers based on the CentralState schedule.
Key components:
- CentralState – Global config: ACCESS mint, inflation schedule, mint authority
- StakePool – Publisher pools with circular buffer for balance tracking (updated via permissionless
crank) - StakeAccount – User deposits into pools; earns yield + grants content access
- Bonds (v1/v2) – Locked tokens with linear vesting, can be staked while locked
solana-cli 1.18.26
cargo 1.72.0
├── smart-contract/
│ ├── program/ # Rust smart contract
│ └── js/ # TypeScript/JS bindings (@accessprotocol/js)
└── scripts/ # Deployment & admin scripts
make buildOutput: smart-contract/program/target/deploy/access_protocol.so
Or directly:
cd smart-contract/program
cargo build-bpf| Feature | Description |
|---|---|
no-mint-check |
Skip mint address validation |
no-bond-signer |
Disable bond signer requirement |
v1-instructions-allowed |
Enable legacy v1 instructions |
days-to-sec-10s |
1 day = 10 seconds (testing) |
days-to-sec-15m |
1 day = 15 minutes (testing) |
cd smart-contract/program
make testOr manually:
# Unit tests
cargo test-bpf --features no-mint-check no-bond-signer v1-instructions-allowed -- --skip functional --skip devnet
# Functional tests (accelerated time)
cargo test-bpf --features no-mint-check no-bond-signer v1-instructions-allowed days-to-sec-10s --test functionalnpm i @accessprotocol/js
# or
yarn add @accessprotocol/jsimport { stake, unstake, ... } from "@accessprotocol/js"cd smart-contract/js
yarn install
yarn buildcd scripts && npm install # first time only
make deploy-full-devnet RPC=https://api.devnet.solana.com
# Or with v1 instructions enabled:
make deploy-full-devnet-v1 RPC=https://api.devnet.solana.comThe RPC parameter is required and can be any Solana RPC endpoint.
This will:
- Create SPL token with metadata
- Build & deploy the program
- Initialize
CentralState - Mint initial tokens
- Transfer mint authority to program
- Migrate to v2 format
Generated in scripts/artifacts/:
| File | Description |
|---|---|
program.json |
Program keypair |
authority.json |
Upgrade authority keypair |
spl_authority.json |
SPL token authority (pre-transfer) |
central_state_pubkey.txt |
CentralState PDA |
mint_address.txt |
ACCESS token mint |
| Target | Description |
|---|---|
make build |
Build the program |
make deploy-full-devnet RPC=<url> |
Full devnet deployment |
make deploy-full-devnet-v1 RPC=<url> |
Deploy with v1 instructions enabled |
make check-program |
Verify .so exists |
make clean |
Clean build artifacts |
GPL-3.0