FLock
Developer GuideGithub
  • What is FLock
    • Introduction to FLock.io
    • The Centralisation Problem
    • Architectural Breakdown
      • System Design
      • Blockchain Layer
      • AI Layer
  • ❤️‍🔥FLock Products
    • AI Arena
      • Participants
      • Quickstart
        • Pre-requisites
          • WSL installation
        • gmFLOCK
        • Delegator Guide
        • Training Node Guide
        • Validator Guide
      • Task Lifecycle Deep-dive
      • Smart Contracts Deep-dive
    • FL Alliance
      • Participants
      • Components
      • Task Lifecycle Deep-dive
        • 1. Staking and Role Assignment
        • 2. FL Training
        • 3. FL Aggregation and Evaluation
        • 4. Rewards
      • Smart Contracts Deep-dive
      • FL Client
        • Pre-Requsites
        • Steps to Quickstart
      • FLocKit
    • AI Marketplace
      • Quickstart
        • Getting started Manual creation
        • Guideline Manual
        • Model API guide
        • Tutorials
          • Create a discord bot with Model API
          • Farcaster Frames with Model API
      • Participants
      • Deep-dive
        • Function breakdown
        • RAG
        • Contribution Mechanism
        • Roadmap
    • 2025 Roadmap
  • 💰FLOCK TOKENOMICS
    • Overview
      • Incentivising open source model development
      • Security
    • Token Utility
      • Supply
      • Demand
    • Network Participation
      • AI Arena
        • Task Creator
        • Data Provider
        • Training Node
        • Validator
        • Delegator
        • Delegation Pool Rewards Explainer
      • FL Alliance
        • Task Creator
        • FL Nodes
      • AI Marketplace
        • Model Host
    • Token Allocations
    • Airdrop
    • Contract Details
  • 💻FLock Use-Cases
    • AI-assisted Coding - FLock x Aptos LLM (outperforms ChatGPT-4o!)
    • AI Assistants - Farcaster GPT, Scroll GPT and many more to come!
    • AI Companions - Professor Grump w/ Akash
    • Web3 Agents - Text2SQL Agent
    • Privacy-preserving Healthcare
  • 📃Resources
    • Litepaper
    • Whitepaper
    • Publications
    • Glossary
    • FAQ
    • Social Media
    • Careers
    • Terms Of Use
    • Privacy Policy
    • FLock.io-Verified Developers
    • FLOCK Token Airdrop Terms and Conditions
Powered by GitBook
On this page
  • Core Contracts
  • FlockTaskManager.sol
  • FlockTask.sol
  • Libraries
  • LibABDKMathQuad.sol
  • LibFlockTask.sol

Was this helpful?

  1. FLock Products
  2. FL Alliance

Smart Contracts Deep-dive

This page gives detailed explanation of FL Alliance's smart contracts.

Previous4. RewardsNextFL Client

Last updated 5 months ago

Was this helpful?

Core Contracts

FlockTaskManager.sol

Role: Factory and lifecycle controller for all FlockTask instances.

  • Task Creation: Deploys new FlockTask contracts, passing in initial parameters like _totalNumberOfRounds, _minStakeThreshold, _initialRewardPoolSize, etc.

  • Task Management: Maintains a list (via EnumerableSet) of active or unfinished FlockTask addresses.

  • Finish Task: The owner can mark a task as finished if necessary (finishTask(...)), removing it from the active set.

FlockTask.sol

Role: This contract implements a decentralized and scalable model for round-based federated learning (“FL tasks”).

  • Staking & Roles: Participants stake tokens to become eligible to join rounds, where they are randomly assigned roles (proposers, voters).

  • Proposal & Voting Rounds: Each round, selected proposers submit model updates, and voters commit/reveal votes that determine the most popular model via stake-weighted voting.

  • Rewards & Slashing: Well-behaved participants (correct contributions/votes) receive rewards; dishonest behaviors can be “slashed,” losing a percentage of their stake.

Libraries

LibABDKMathQuad.sol

Role: Quadruple-precision (128-bit) math operations.

  • Implements IEEE 754–style floating-point arithmetic for bytes16 values.

  • Provides precision far beyond typical fixed-point or 256-bit integer math.

  • Useful for advanced computations like logarithms, exponentials, or rational approximations.

LibFlockTask.sol

Role: Provides specialized numeric and utility functions for federated-learning tasks. Key Functions include:

  • mulDiv(uint256 x, uint256 y, uint256 z)

    • Combines multiplication and division with quadruple precision by leveraging LibABDKMathQuad.

  • rand()

    • Generates a pseudo-random number by hashing block and transaction properties.

❤️‍🔥
FL Alliance Smart Contract Interactions.