Skip to main content

A decentralized federated learning framework with privacy guarantees, created by Jihad GARTI

Project description

DecentraLearn Logo

DecentraLearn

Python Version License Documentation Tests

A decentralized federated learning framework with strong privacy guarantees, built on blockchain technology.

🚀 Features

  • Federated Learning

    • Decentralized model training
    • Secure model aggregation
    • Incentive mechanisms
    • Smart contract-based coordination
  • Privacy Mechanisms

    • Differential Privacy
    • Homomorphic Encryption
    • Zero-Knowledge Proofs
    • Secure Aggregation
  • Blockchain Integration

    • Smart contract-based verification
    • Transparent model tracking
    • Decentralized coordination
    • Incentive distribution
  • Advanced Security

    • End-to-end encryption
    • Model integrity verification
    • Access control
    • Audit logging

📦 Installation

Install via pip (Recommended)

You can install the latest release (v2.1.0) directly from PyPI:

pip install decentralearn

To upgrade to the latest version:

pip install --upgrade decentralearn

Note: If you encounter dependency issues (especially with eth-tester), try installing the beta version first:

pip install eth-tester==0.13.0b1
pip install decentralearn

Or install all dependencies manually:

pip install torch>=2.0.0 numpy>=1.21.0 scipy>=1.7.0 opacus>=1.1.0 phe>=1.5.0 web3>=6.0.0 eth-tester==0.13.0b1 eth-utils>=2.1.0
pip install decentralearn

Prerequisites

  • Python 3.8 or higher
  • Ethereum node (e.g., Ganache for development)
  • PyTorch 1.7 or higher

Installation Steps (from source)

  1. Clone the repository:

    git clone https://github.com/ackerman23/decentralearn
    cd decentralearn
    
  2. Create and activate a virtual environment:

    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    
  3. Install dependencies:

    pip install -e .
    

🏁 Quick Start

  1. Initialize blockchain connection:

    from decentralearn.blockchain.client import BlockchainClient
    from decentralearn.config.blockchain_config import BlockchainConfig
    
    config = BlockchainConfig(
        rpc_url="http://localhost:8545",
        chain_id=1337
    )
    client = BlockchainClient(config)
    
  2. Create and train a model:

    from decentralearn.models.base import BaseModel
    from decentralearn.privacy import DifferentialPrivacy
    
    model = BaseModel()
    dp = DifferentialPrivacy(epsilon=0.1)
    # Train model with privacy
    
  3. Upload to blockchain:

    client.upload_model(model)
    

📚 Documentation

Comprehensive documentation is available in the docs/ directory:

🧪 Testing

Run the test suite:

pytest tests/

For detailed test output:

pytest -v tests/

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📝 License

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

Creator: Jihad GARTI (jihad.garti2@gmail.com)

📧 Support

For questions and support:

  1. Check the FAQ
  2. Open an issue on GitHub
  3. Contact the maintainers

🙏 Acknowledgments

  • PyTorch team for the deep learning framework
  • Ethereum community for blockchain infrastructure
  • Privacy research community for privacy-preserving techniques

📄 Citation

If you use DecentraLearn in your research, please cite:

@software{decentralearn2024,
  author = {Jihad GARTI},
  title = {DecentraLearn: A Decentralized Federated Learning Framework},
  year = {2024},
  publisher = {Jihad GARTI},
  url = {https://github.com/ackerman23/decentralearn}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decentralearn-2.1.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decentralearn-2.1.0-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file decentralearn-2.1.0.tar.gz.

File metadata

  • Download URL: decentralearn-2.1.0.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for decentralearn-2.1.0.tar.gz
Algorithm Hash digest
SHA256 d7f08935369beb70eea5d62c1ff80b06e34133a550abb4472323a989f3f4cd57
MD5 4c6ffc56ad703eb624878931c215e1b8
BLAKE2b-256 032f72cf720c66019cf4d3422665d8ee4c6da8fb950cd49be9febaa15adc78d4

See more details on using hashes here.

File details

Details for the file decentralearn-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: decentralearn-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for decentralearn-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d3ea444a069570ecad09ee99b21dad8641a85a3bcb55ec349b933ba4d0f2f139
MD5 67394f2354917cf07cd9835b4eb7c601
BLAKE2b-256 7343cc6a57076e111e74d4397137b693628c147715e66ab586622f539c16fc74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page