Skip to content

kamalbuilds/decentralised-federated-learning-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Decentralized Federated Learning Platform

A blockchain-based federated learning platform built on NEAR Protocol that enables decentralized machine learning model training while preserving data privacy.

Features

  • Decentralized model training using federated learning
  • Privacy-preserving data handling
  • NEAR blockchain integration for transparency and incentives
  • Real-time model status tracking
  • Participant management system
  • Reward distribution mechanism

Flow Diagram

graph TB
subgraph Frontend
UI[User Interface]
ML[TensorFlow.js Model]
WI[Wallet Integration]
subgraph ML Components
PP[Data Preprocessing]
TR[Model Training]
DP[Differential Privacy]
end
UI --> WI
UI --> ML
ML --> PP
ML --> TR
TR --> DP
end
subgraph Smart Contract
PR[Participant Registry]
MU[Model Updates]
RD[Reward Distribution]
MS[Model Status]
end
subgraph NEAR Protocol
BC[Blockchain]
WL[Wallet]
end
%% Frontend to Smart Contract Interactions
WI --> WL
DP --> MU
UI --> PR
UI --> MS
%% Smart Contract to Blockchain
PR --> BC
MU --> BC
RD --> BC
MS --> BC
%% Blockchain to Wallet
BC --> WL
style Frontend fill:#f9f9f9,stroke:#333,stroke-width:2px
style Smart Contract fill:#e6f3ff,stroke:#333,stroke-width:2px
style NEAR Protocol fill:#f0fff0,stroke:#333,stroke-width:2px?
Loading

Tech Stack

  • Frontend: Next.js, TypeScript, TailwindCSS
  • Smart Contract: Rust, near-sdk
  • Blockchain: NEAR
  • Machine Learning: TensorFlow.js

Prerequisites

  • Node.js >= 16
  • Rust toolchain
  • NEAR CLI
  • A NEAR testnet account

Installation

  1. Clone the repository:
git clone https://github.com/kamalbuilds/decentralised-federated-learning-platform
cd decentralised-federated-learning-platform
  1. Install frontend dependencies:
cd frontend
npm install
  1. Build the smart contract:
cd contract
cargo near build

Smart Contract Deployment

  1. Login to your NEAR testnet account:
near login
  1. Deploy the contract:
near deploy --accountId your-testnet-account.testnet --wasmFile target/wasm32-unknown-unknown/release/contract.wasm

Running the Application

  1. Start the frontend development server:
cd frontend
npm run dev
  1. Open your browser and navigate to http://localhost:3000

Usage

  1. Connect Wallet: Click "Connect Wallet" to link your NEAR account

  2. Register as Participant: Register to participate in the federated learning process

  3. Train Model: Contribute to model training using your local data

  4. View Status: Monitor training progress and model updates

  5. Receive Rewards: Earn rewards for successful contributions

Architecture

Smart Contract

  • Manages participant registration
  • Handles model updates
  • Distributes rewards
  • Maintains training status

Frontend

  • User interface for model training
  • Wallet integration
  • Real-time status updates
  • Training visualization

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • NEAR Protocol team
  • Federated Learning community
  • Open source contributors