On chain
The on-chain infrastructure was designed with four main smart contracts, each serving a specific purpose in the decentralized workflow. These contracts ensured data integrity, accessibility, and secure interactions within the system.
1. BlobID Storage Contracts
Two BlobID storage contracts were deployed to handle different types of on-chain references, ensuring seamless decentralized access to critical resources stored on Walrus.
Model Publisher Contract:
Stores the BlobID of the machine learning model uploaded by the model publisher.
Allows Contributors to retrieve the BlobID and access the model from Walrus for local training.
Encryption File Storage Contract:
Stores the BlobID of the encryption file uploaded by the contributors after local model training.
This encryption file is used by the Model Publisher for verification of the contributor’s training results.
Ensures that the verification process remains decentralized and immutable.
2. Aggregator Contract
The Aggregator Contract plays a central role in the federated learning process:
Federated Averaging: It collects and decrypts the submitted encryption files (based on the Pedersen commitment or Paillier cryptosystem) to compute the federated average of the training results.
Verification and Aggregation: Ensures that only valid contributions are considered in the final aggregated model.
Transparency: The results of the federated averaging are stored on-chain for accountability and further use.
3. Staking Contract
The Staking Contract is responsible for user management and financial incentives/disincentives within the system:
User Registration: Enables contributors to register and participate in the training process.
Staking Mechanism:
Contributors stake tokens to demonstrate their commitment to honest participation.
Stakes are slashed in the event of malicious behavior or invalid training results, as identified during the verification process.
Reward Distribution: Allocates rewards to contributors based on their valid contributions to the federated training process.
Stake Management: Supports functions for staking, withdrawing stakes, and tracking user balances.
Workflow Summary
Model Upload:
The Model Publisher uploads the model to Walrus, and its BlobID is stored in the Model Publisher Contract.
Contributor Participation:
Contributors stake tokens using the Staking Contract and retrieve the model’s BlobID for access.
Training and Submission:
Contributors train the model locally and upload the encryption file (for verification) to Walrus. Its BlobID is stored in the Encryption File Storage Contract.
Verification and Aggregation:
The Aggregator Contract retrieves encrypted training results, decrypts them, and performs federated averaging.
Valid results are used to update the global model, while malicious nodes face stake slashing.
Benefits of On-Chain Design
Transparency: All interactions (model storage, encryption file verification, and staking activities) are auditable on-chain.
Decentralization: Ensures no single point of failure by storing critical references on Walrus and managing the process through smart contracts.
Accountability: Stake slashing discourages malicious behavior, and the federated average ensures collective decision-making.
Security: The use of cryptographic schemes and on-chain contracts protects against fraud and enhances trust.
This on-chain design provided the backbone for a decentralized, secure, and transparent federated learning system.
Last updated