Skip to main content
The NullGraph smart contract is a Solana program built with Anchor 0.31.1 that manages the on-chain infrastructure for Null Knowledge Assets (NKAs) and the bounty marketplace.

Program ID

Declared in lib.rs:8:

Technology Stack

Anchor 0.31.1
Solana program development framework providing type-safe account validation, PDA derivation, and CPI abstractions
Rust 2021
Systems programming language ensuring memory safety and zero-cost abstractions
anchor-spl 0.31.1
Token interface for USDC transfers via CPI using transfer_checked for decimal validation

Architecture

The program implements a decentralized bounty marketplace for null scientific results using four core account types:

Program Flow

Security Model

All program operations are protected by Anchor’s account validation framework:
  • Signer enforcement: Every mutation requires the appropriate authority (researcher, bounty creator, or protocol authority)
  • PDA ownership: All data accounts are program-owned PDAs preventing external modification
  • Status guards: Instructions validate current account status before state transitions
  • Replay protection: PDA init constraints prevent duplicate accounts
  • Vault authority: Token vaults use the vault PDA itself as authority, only accessible via CPI with correct signer seeds
  • Safe arithmetic: All fee calculations use checked math operations (checked_mul, checked_div, checked_sub)
  • Transfer validation: transfer_checked validates mint address and decimal precision on every USDC transfer

File Structure

The entire program is contained in a single file:

Next Steps

Accounts

Explore all account structures and their fields

Instructions

Learn about all 6 program instructions

Events

Review emitted events for indexing

Errors

Reference all custom error codes