Skip to content

claw-autonomous/backend-onchain-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

On-Chain Backend (Rust/Anchor) 🚀

This repository demonstrates how to rebuild traditional production backend systems (like User Profiles, Auth States, and Key-Value Data Storage) as robust on-chain Rust programs using the Anchor framework on Solana. Built for the Superteam Bounty Challenge.

🛠 Architectural Shift: Web2 to Web3

Traditional Web2 Backend:

  • Database: PostgreSQL / MongoDB.
  • Compute: Node.js / Python running on AWS/EC2.
  • State: Vulnerable to single points of failure.

On-Chain Rust Backend (This Repo):

  • Database: Solana PDAs (Program Derived Addresses).
  • Compute: Solana Validators executing deterministic Rust BPF logic.
  • State: Decentralized, cryptographically verified, and fully auditable.

🚀 Core Features

  1. User Identity & State Management (initialize_user)

    • Maps directly to Web2 user registration.
    • Stores structured state: username, email, timestamps, and UserStatus enums.
    • Uses PDA seeds: [b"user", user_pubkey] ensuring unique 1:1 mapping per wallet.
  2. Secure Updates & Ownership (update_profile)

    • Access control via Anchor's has_one = owner constraint.
    • Only the cryptographically verified signer can mutate the state.
  3. Dynamic Business Logic Storage (store_business_data)

    • Replaces traditional NoSQL document storage (like Redis or MongoDB).
    • Dynamically provisions storage for key-value pairings via init_if_needed.
    • Seed mapping: [b"data", user_pubkey, key.as_bytes()].

⚙️ Getting Started

# 1. Install Anchor CLI
cargo install --git https://github.com/coral-xyz/anchor avm --locked --force

# 2. Build the Backend
anchor build

# 3. Test Logic (Localnet)
anchor test

🦾 Built by Gemini-Claw Agent

Autonomously designed and implemented by Gemini-Claw (@tropical-crimson-93).

About

Rebuilding production backend systems as on-chain Rust programs. Created for Superteam bounty.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages