Skip to content

Scatter Protocol: An Incentivized and Trustless Protocol for Decentralized Federated Learning - Accepted to IEEE International Conference on Blockchain

Notifications You must be signed in to change notification settings

gtfintechlab/scatter-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scatter Protocol

Scatter Protocol is an incentivized and trustless protocol for decentralized, federated learning. The Scatter Protocol repository has two primary components to it:

  • Core: This contains all the core code for the client node and protocol. The client node consists of an HTTP server, which allows you to interact with the node and protocol more broadly. Other components include a peer-to-peer server for inter-node communication, an asynchronous job queue, a data store, and event listeners. The protocol is defined through smart contracts, as provided by the core/contracts folder.
  • Web Interface: We provide a simple web interface to run simulations. This interface allows you to control the number of nodes, roles each node plays, steps to execute for each node, etc.

If you find this project useful in your research, please use the following BibTeX entry for citation.

@INPROCEEDINGS{10664423,
  author={Sahoo, Samrat and Chava, Sudheer},
  booktitle={2024 IEEE International Conference on Blockchain (Blockchain)}, 
  title={Scatter Protocol: An Incentivized and Trustless Protocol for Decentralized Federated Learning}, 
  year={2024},
  volume={},
  number={},
  pages={497-504},
  keywords={Training;Resistance;Protocols;Federated learning;Distributed ledger;Trustless services;Blockchains;Blockchains;Distributed Systems;Federated Learning;Smart Contracts;Ethereum;Tokenization},
  doi={10.1109/Blockchain62396.2024.00073}}

You can read our paper here

Technology Specifications

  • Blockchain: Any EVM Compatible Chain (Production) or Hardhat Network (Development)
  • Node Datastore: PostgreSQL
  • Peer-to-Peer Communication: go-libp2p
  • Training Job Runtime Environment: Docker Open Container Initiative (OCI) Runtime
  • Smart Contracts: Solidity Solc Go-Ethereum Client
  • Web Interface: MongoDB Next.js

Setup Repository Locally

This repository requires Docker to run external resources (i.e., PostgreSQL, Hardhat Network, etc.). To instantiate these resources:

  1. Install Docker
  2. Start the external resources with Docker Compose: docker compose up

We recommend interacting with the protocol via the web interface and the wrapper API we provide to control nodes. You can set this up as follows.

Step 1: Install dependencies for the core module:

cd core
go mod download

Step 2: Generate keys for the bootstrap node (make sure you are still in the core folder)

go run main.go --util keygen

Step 3: Modify the multiaddress for the bootstrap node (BOOTSTRAP_NODE_MULTIADDR in core/utils/types.go). The format of the multiaddress takes the following: /ip4/127.0.0.1/tcp/{PORT NUMBER}/p2p/{NODE ID}. The bootstrap node is currently configured to be on port 7001 automatically. You can get the node ID by spinning up the bootstrap node and seeing the ID in the console. You can do this with the following command:

go run main.go --type bootstrap
> 2023/12/30 20:02:35 bootstrap_node.go:24: Bootstrap Node: QmSgdAwbFv5W1eLwCzmwFT8NqCnQTvWWrj3avtAfWPFjTm

Step 4: Install OpenZepplin contracts (using yarn)

yarn install

Step 5: Run the Wrapper API

yarn api

Step 6: Open a new terminal and install dependencies for the web interface

cd web
yarn install

Step 7: Start the web interface

yarn dev