Skip to content

cesarMalanco/ScoutChain

Repository files navigation

⚽ Scout Chain: Solana Scouting Program

Solana Rust Anchor License

A decentralized scouting platform for football players and scouts built on Solana.


🎯 About The Project

Scout Chain is a smart contract built using the Anchor framework that facilitates a transparent scouting ecosystem. It allows players to showcase their stats and scouts to provide verified on-chain reviews.

Core Architecture: PDAs & CRUD

The program utilizes Program Derived Addresses (PDAs) to ensure data integrity and user-specific ownership. It implements a full CRUD (Create, Read, Update, Delete) cycle for:

  • Players: Personal profiles with stats and video links.
  • Scouts: Professional profiles with organization and experience.
  • Reviews: Dynamic reviews linked between a scout and a player.

✨ Features

⚽ Player Management

  • Create Profile: Initialize a unique PDA based on the user's wallet.
  • Update Stats: Edit position, age, and performance metrics (CRUD: Update).
  • On-Chain Metrics: Track total reviews and average ratings (CRUD: Read).

🔍 Scouting & Reviews

  • Verified Scouts: Only registered scouts can leave reviews.
  • Dynamic Review PDAs: Reviews are derived using the player's key, the scout's key, and a review counter.
  • Deactivation: Ability to deactivate profiles to prevent further interactions.
  • Rent Recovery: Delete reviews to close accounts and recover SOL (CRUD: Delete).

🔐 Security

  • Owner Validation: require! macros ensure only the account creator can modify their data.
  • PDA Seeds:
    • ["player", authority]
    • ["scout", authority]
    • ["review", player_pubkey, scout_pubkey, review_count]

🏗️ Program Architecture

📦 Player Account

Player {
    authority: Pubkey,
    name: String,
    position: String,
    age: u8,
    stats: String,
    video_url: String,
    review_count: u32,
    rating_sum: u32,
    is_active: bool,
}

🔑 PDA Seeds

["player", player_authority_pubkey]
["scout", scout_authority_pubkey]
["review", player_pda, scout_pda, review_index]


🌐 Deployment Information

The program is live on Solana Devnet. You can verify the instructions and account states on the explorer:

Program ID: CXYaPQ451V8DD43pWCepNyddkf2Pnjk3mqvLgchJR5Fb

👉 View on Solana Explorer


🧪 Testing & Devnet Validation

The test suite is built in TypeScript and performs a full lifecycle check. It uses fresh Keypair generation for every run to avoid PDA collisions and provides direct links to the explorer for each transaction.

Test Screenshot

Test screenshot

How to run the tests

  1. Ensure you have Devnet SOL in your local wallet (solana balance).
  2. Run the following command:
anchor test --provider.cluster devnet --skip-deploy --skip-local-validator

The test will log:

  • Transaction Links: Direct URLs to Solana Explorer for every action.
  • CRUD Logs: Confirmation of player creation (Pedri), scout creation (Xavi), and review management.

🔧 Installation & Setup

Prerequisites

Requirement Version
Rust Latest stable
Solana CLI 1.18+
Anchor CLI 0.30+
Node.js 20+

Quick Start

# Clone the repository
git clone [https://github.com/cesarMalanco/scout-chain.git](https://github.com/cesarMalanco/scout-chain.git)

# Navigate into project
cd scout-chain

# Install dependencies
npm install

# Build the program
anchor build

# Run tests on Devnet
anchor test --provider.cluster devnet

🛡️ Error Handling

Custom errors defined in the program:

  • InvalidRating: Rating must be between 1 and 5.
  • Unauthorized: Only the owner can modify the account.
  • InactiveProfile: Cannot interact with deactivated accounts.

📜 License

This project is licensed under the MIT License.


👨‍💻 Author

César Malanco

Built with ❤️ using Rust, Anchor & Solana

About

A decentralized scouting platform built on Solana using the Anchor framework. Features a full CRUD system for football players and scouts using Program Derived Addresses (PDAs).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors