Skip to content

PlatformNetwork/bounty-challenge-v2

 
 

Repository files navigation

bουηtү chαllεηgε

GitHub Issue Reward System for Platform Network

CI License GitHub stars Rust

Bounty Challenge Banner

Bounty Challenge is a WASM evaluation module for Platform Network. Miners earn rewards by discovering and reporting valid GitHub issues. Issues must be closed with the valid label by project maintainers to qualify for rewards.

IMPORTANT: To receive rewards, you MUST submit issues in this repository (PlatformNetwork/bounty-challenge). Issues submitted directly to other repositories will NOT be counted for rewards.

How to Mine

1. Register Your Hotkey

Before mining, register your GitHub username with your Bittensor hotkey using the CLI:

# Build the CLI
cargo build --release -p bounty-cli

# Register (replace with your values)
./target/release/bounty-cli register \
  --hotkey YOUR_SS58_HOTKEY \
  --github YOUR_GITHUB_USERNAME \
  --signature YOUR_HEX_SIGNATURE \
  --timestamp UNIX_TIMESTAMP \
  --rpc-url http://VALIDATOR_IP:8080

The signature is created by signing the message register_github:{username_lowercase}:{timestamp} with your sr25519 hotkey. The timestamp must be within 5 minutes of the validator's server time.

2. Find and Report Issues

  1. Discover valid bugs or issues in eligible repositories
  2. Submit the issue in this repository (PlatformNetwork/bounty-challenge)
  3. Wait for project maintainers to review and close the issue with the valid label

3. Check Your Status

# View the leaderboard
./target/release/bounty-cli leaderboard --rpc-url http://VALIDATOR_IP:8080

# Check your miner status
./target/release/bounty-cli status --hotkey YOUR_SS58_HOTKEY --rpc-url http://VALIDATOR_IP:8080

# View challenge statistics
./target/release/bounty-cli stats --rpc-url http://VALIDATOR_IP:8080

4. Earn Rewards

Rewards are distributed based on your weight, which is calculated from your valid issues and star bonuses. See Scoring & Rewards for the full formula.

CLI

The bounty-cli binary communicates with Platform Network validators via JSON-RPC.

Installation

cargo build --release -p bounty-cli

Commands

# Show leaderboard (top 50 by default)
bounty-cli leaderboard [--limit N] [--rpc-url URL]

# Register GitHub username with hotkey
bounty-cli register --hotkey HOTKEY --github USERNAME --signature SIG --timestamp TS [--rpc-url URL]

# Check miner status
bounty-cli status --hotkey HOTKEY [--rpc-url URL]

# Show challenge statistics
bounty-cli stats [--rpc-url URL]

The --rpc-url flag defaults to http://localhost:8080. You can also set the BOUNTY_RPC_URL environment variable.

Architecture

This project is a #![no_std] Rust crate compiled to wasm32-unknown-unknown. It implements the Challenge trait from platform-challenge-sdk-wasm and runs inside the Platform Network validator runtime.

flowchart LR
    subgraph Validator["Platform Validator"]
        Runtime["WASM Runtime"]
        Storage["Host Storage"]
        Runtime -->|"host_storage_get/set"| Storage
    end
    
    subgraph Module["bounty-challenge.wasm"]
        Evaluate["evaluate()"]
        Routes["handle_route()"]
        Weights["get_weights()"]
    end
    
    Runtime -->|"loads"| Module
    Miner["🧑‍💻 Miner"] -->|"submit claims"| Evaluate
    API["Chain RPC"] -->|"route requests"| Routes
    Chain["On-Chain"] -->|"weight queries"| Weights
Loading

Key Features

  • WASM Module: Runs inside the validator's sandboxed WASM runtime
  • On-Chain Storage: All state persisted via host-provided key/value storage
  • Validator Consensus: Multi-validator agreement on issue validity and sync data
  • Weight Calculation: Normalized weight assignments for on-chain rewards
  • Chain RPC Routes: Leaderboard, stats, registration, claims, and more

Building

# Install WASM target (one-time)
rustup target add wasm32-unknown-unknown

# Build the WASM module
cargo build --release --target wasm32-unknown-unknown

# Output: target/wasm32-unknown-unknown/release/bounty_challenge.wasm

# Build the CLI
cargo build --release -p bounty-cli

Reward System

Point System

Source Points Description
Valid Issue 1 point Issue closed with valid label
Starred Repo 0.25 points Each starred target repository

Weight Calculation

$$W_{user} = net_points \times 0.02$$

Where:

  • net_points = valid_count + star_bonus - penalty
  • Weights are normalized to sum to 1.0 across all miners

Penalty System

Rule Description
Invalid Penalty max(0, invalid_count - valid_count)
Duplicate Penalty max(0, duplicate_count - valid_count)
Zero Weight If net points ≤ 0, weight = 0

API Routes

All routes are served through the Platform Network validator chain RPC. Access them via:

  • HTTP: GET/POST http://VALIDATOR:8080/challenge/bounty-challenge/<path>
  • JSON-RPC: challenge_call method at http://VALIDATOR:8080/rpc
Method Path Auth Description
GET /leaderboard No Current standings
GET /stats No Challenge statistics
GET /status/:hotkey No Hotkey status and balance
POST /register Yes Register GitHub username with hotkey
POST /claim Yes Claim bounty for resolved issues
GET /issues No List all synced issues
GET /issues/pending No List pending issues
GET /hotkey/:hotkey No Detailed hotkey information
POST /invalid Yes Record an invalid issue
POST /sync/propose Yes Propose synced issue data
GET /sync/consensus No Check sync consensus status
POST /issue/propose Yes Propose issue validity
POST /issue/consensus No Check issue validity consensus
GET /config/timeout No Get timeout configuration
POST /config/timeout Yes Update timeout configuration
GET /get_weights No Normalized weight assignments

Project Structure

bounty-challenge/
├── Cargo.toml               # Workspace + WASM crate config
├── bins/
│   └── bounty-cli/          # CLI binary
│       ├── Cargo.toml
│       └── src/main.rs
├── src/
│   ├── lib.rs               # Challenge trait implementation
│   ├── types.rs             # Domain types
│   ├── scoring.rs           # Weight calculation
│   ├── consensus.rs         # Validator consensus
│   ├── validation.rs        # Issue validation and claims
│   ├── routes.rs            # Route definitions and dispatch
│   ├── api/
│   │   └── handlers.rs      # Route handlers
│   └── storage/
│       └── bounty_storage.rs # Host key/value storage
├── docs/                    # Documentation
└── .github/workflows/       # CI configuration

Development

# Format code
cargo fmt

# Lint (must target wasm32)
cargo clippy --target wasm32-unknown-unknown

# Check compilation
cargo check --target wasm32-unknown-unknown

# Build CLI only
cargo build -p bounty-cli

Anti-Abuse Mechanisms

Mechanism Description
Valid Label Required Only issues closed with valid label count
Signature Verification sr25519 signature proves hotkey ownership
Author Verification GitHub username must match issue author
First Reporter Wins Each issue can only be claimed once
Validator Consensus Multiple validators must agree on issue validity
Label Protection GitHub Actions prevent unauthorized label changes

Documentation

Acknowledgments

License

Apache-2.0

About

[🤝] bounty-challenge incentivizes bug discovery and software improvement through community-driven reports and suggestions, with rewards based on impact and quality.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 58.6%
  • Rust 39.7%
  • Shell 1.7%