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

2u3DXQq9A6UgMryeVSWCNdYLy3Fjh391R5hcfWYkCgZK
Declared in lib.rs:8:
declare_id!("2u3DXQq9A6UgMryeVSWCNdYLy3Fjh391R5hcfWYkCgZK");

Technology Stack

Framework
Anchor 0.31.1
Solana program development framework providing type-safe account validation, PDA derivation, and CPI abstractions
Language
Rust 2021
Systems programming language ensuring memory safety and zero-cost abstractions
SPL Token
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:
programs/nullgraph/src/lib.rs  (~593 lines)
├── Program Module (lines 14-274)
│   ├── initialize_protocol
│   ├── submit_null_result
│   ├── create_bounty
│   ├── submit_to_bounty
│   ├── approve_bounty_submission
│   └── close_bounty
├── Account Contexts (lines 280-466)
│   ├── InitializeProtocol
│   ├── SubmitNullResult
│   ├── CreateBounty
│   ├── SubmitToBounty
│   ├── ApproveBountySubmission
│   └── CloseBounty
├── Data Accounts (lines 472-526)
│   ├── ProtocolState
│   ├── NullResult
│   ├── NullBounty
│   └── BountySubmission
├── Events (lines 532-573)
│   └── 6 event structs
└── Errors (lines 579-593)
    └── NullGraphError enum

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

Build docs developers (and LLMs) love