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.4.tar.gz (24.0 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.4-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: decentralearn-2.1.4.tar.gz
  • Upload date:
  • Size: 24.0 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.4.tar.gz
Algorithm Hash digest
SHA256 2bea9c31cac7b57381751b6bee20b285581a67cc0c960e2e3808512144b6f9eb
MD5 a8ff3549c7479bafd9cc192cfcea4d96
BLAKE2b-256 972ebf4a6d8b37ee625f9a13221805e04fbcf56922686d4f7c0bc6e2f2b72c1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: decentralearn-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 29.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 164a89e3dcd07b7f62f20dc8a53bc24588bc20eb89251bc8031d5f968bf817e8
MD5 a97321d0bbf65a65fefc046a1ae79d69
BLAKE2b-256 b3ad1c997aca7edef9dd00c4cc5c42cb56f1d75783e447e539c79ab8966241d6

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