GLIN Chain is the blockchain infrastructure powering the GLIN federated learning marketplace. Built with Substrate, it provides trustless task management, provider staking, and reward distribution for decentralized AI training.
- π Trustless Task Escrow: Secure bounty locking for ML training tasks
- π° Provider Staking: Economic security through stake-based participation
- π― Batch Rewards: Efficient merkle-tree based reward distribution
- π‘οΈ Slashing Mechanism: Automated penalties for malicious behavior
- π ZKP Validation: On-chain verification for high-value computations
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install Substrate dependencies
sudo apt update && sudo apt install -y git clang curl libssl-dev llvm libudev-dev make protobuf-compiler
# Clone the repository
git clone https://github.com/glin-ai/glin-chain.git
cd glin-chain# Build the node
cargo build --release
# Run development node
./target/release/glin-node --dev
# Run with custom chain spec
./target/release/glin-node --chain=local# Build Docker image
docker build -t glin-chain .
# Run container
docker run -p 9944:9944 -p 9933:9933 glin-chain| Pallet | Purpose | Key Functions |
|---|---|---|
| task-registry | Task lifecycle management | create_task, cancel_task, complete_task |
| provider-staking | Provider registration & staking | register_provider, slash_provider, withdraw_stake |
| reward-distribution | Batch reward processing | create_batch, submit_rewards, settle_batch |
| validation-zkp | Zero-knowledge proof verification | submit_proof, verify_gradient |
| reputation | Provider reputation tracking | update_score, get_reputation |
- Token: GLIN
- Total Supply: 1,000,000,000 GLIN
- Minimum Provider Stake: 1,000 GLIN
- Minimum Task Bounty: 10 GLIN
- Platform Fee: 2% of rewards
- Slashing Rate: 10% for violations
# Generate chain spec
./target/release/glin-node build-spec --chain=local > customSpec.json
# Generate raw chain spec
./target/release/glin-node build-spec --chain=customSpec.json --raw > customSpecRaw.json- P2P: 30333
- RPC: 9933
- WebSocket: 9944
- Prometheus: 9615
# Run all tests
cargo test
# Run pallet tests
cargo test -p pallet-task-registry
cargo test -p pallet-provider-staking
cargo test -p pallet-reward-distribution
# Run integration tests
cargo test --test '*'
# Run benchmarks
cargo test --features runtime-benchmarksimport { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('ws://localhost:9944');
const api = await ApiPromise.create({ provider });
// Create a task
const tx = api.tx.taskRegistry.createTask(
'Image Classification',
'ResNet',
1000000000000, // 1 GLIN bounty
3, // min providers
10, // max providers
'QmHash...', // IPFS hash
{ minVramGb: 8, minComputeCapability: 75, minBandwidthMbps: 100 }
);
await tx.signAndSend(alice);from substrateinterface import SubstrateInterface
substrate = SubstrateInterface(
url="ws://localhost:9944",
type_registry_preset='substrate-node'
)
# Query provider info
result = substrate.query(
module='ProviderStaking',
storage_function='Providers',
params=['5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY']
)# prometheus.yml
scrape_configs:
- job_name: 'glin-node'
static_configs:
- targets: ['localhost:9615']Import our Grafana dashboard for real-time metrics.
# Generate pallet template
substrate-node-new-pallet my-pallet
# Add to runtime
# Edit runtime/src/lib.rs# Build new runtime
cargo build --release -p glin-runtime
# Submit upgrade transaction
# Via polkadot.js or CLIWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Format code
cargo fmt
# Run clippy
cargo clippy -- -D warnings- Pallet logic audit (Planned Q1 2025)
- Runtime audit (Planned Q2 2025)
Report security vulnerabilities to [email protected]. See SECURITY.md for our bug bounty program.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Website: https://glin.ai
- Documentation: https://docs.glin.ai
- Discord: Join our community
- Twitter: @glin_ai
Built with Substrate by Parity Technologies
Made with β€οΈ by the GLIN AI team