Contributing
Thank you for your interest in improving DFPN. This guide covers how to report issues, set up a development environment, and submit pull requests.
Ways to Contribute
- Report bugs -- Open a GitHub issue with steps to reproduce
- Suggest features -- Start a discussion or open a feature-request issue
- Submit pull requests -- Fix a bug, improve docs, or add a feature
- Run a worker node -- Help test the network on devnet/testnet
- Write detection models -- Build and register new detection algorithms
Development Setup
Prerequisites
| Tool | Version | Purpose |
|---|---|---|
| Rust | 1.75+ | Worker, indexer, on-chain programs |
| Node.js | 18+ | SDK, dashboard, tests |
| Anchor | 0.30.1 | Solana program framework |
| Solana CLI | 1.18+ | Cluster management and key generation |
| Python | 3.10+ | Detection model runtimes |
Clone and Build
# Clone the repository
git clone https://github.com/cryptuon/dfpn.git
cd dfpn
# Install Node.js dependencies
npm install
# Build Solana programs
anchor build
# Build the worker
cargo build --release -p dfpn-worker
# Build the indexer
cargo build --release -p dfpn-indexer
# Set up the dashboard
cd dashboard && npm install && cd ..
Run Tests
# Start a local Solana validator and run Anchor tests
anchor test
# Run Rust unit tests
cargo test
# Run dashboard dev server
cd dashboard && npm run dev
Project Structure
programs/ # Solana smart contracts (Anchor)
shared/ # Shared types, constants, seeds
content-registry/ # Media hash and provenance
analysis-marketplace/ # Request lifecycle and commit-reveal
model-registry/ # Model metadata and versioning
worker-registry/ # Worker staking and reputation
rewards/ # Fee distribution and treasury
worker/ # Node operator client (Rust + Tokio)
indexer/ # REST API indexer (Axum + Tantivy)
sdk/ # TypeScript SDK (@solana/web3.js)
models/ # Pre-configured detection models
dashboard/ # Vue 3 + TypeScript + Tailwind CSS 4
documentation/ # MkDocs user-facing documentation
docs/ # Technical design documents
scripts/ # Deployment and setup scripts
tests/ # Integration tests (TypeScript)
Code Style
Rust
- Format with
cargo fmtbefore committing - Run
cargo clippyand fix all warnings - Follow the Rust API Guidelines
- Use
///doc comments for public items
TypeScript
- Lint with ESLint (
npx eslint .) - Use strict TypeScript (
strict: truein tsconfig) - Prefer
constoverlet
Vue (Dashboard)
- Use
<script setup lang="ts">with the Composition API - One component per file
- Props and emits must be typed
Testing
Anchor Tests
Integration tests live in tests/ and run against a local Solana validator.
# Run all program tests
anchor test
# Run a specific test file
anchor test -- --grep "content registry"
Local Validator
For manual testing you can start a persistent local validator:
Worker Tests
Pull Request Guidelines
- Create a branch from
mainwith a descriptive name (fix/slash-calculation,feat/model-search,docs/api-reference) - Write a clear title that summarizes the change in one line
- Include a test plan -- describe how to verify the change works
- Link related issues using
Closes #123orRelates to #456 - Keep PRs focused -- one logical change per PR
- Ensure CI passes -- all tests, lints, and builds must succeed
Good PR description
Communication
- GitHub Issues -- Bug reports, feature requests, and task tracking
- GitHub Discussions -- Questions, ideas, and general conversation
- Discord -- Real-time chat with the community (link coming soon)
License
DFPN is released under the MIT License. By contributing, you agree that your contributions will be licensed under the same terms.