Flex Docs (Work-In-Progress | Last Updated: 12/07)
  • Current Landscape
  • Welcome to Flex
  • Overview
    • Infrastructure for the New Web
    • The Values of the Flex Ecosystem
  • Protocol
    • Flex Validator Nodes
      • Data and Validation Layer
      • Rewards Layer
      • Audit Layer
      • Sentinel Layer
      • Prediction Layer
      • Getting Started
        • Propagation into the Validation Layer
        • Transaction Pool Generation
        • Transaction Weight Assignment
        • Epoch Score Calculation
        • Reward Distribution
        • Reward Claiming
        • Epoch Reward Pool Mechanics
    • Proof-of-Collaboration (PoCol)
      • PoCol Governance using FLEXE
      • Actors in the Flex Ecosystem
    • Flex Commons
      • Code Tokenization
      • Code Registry and Indexing
      • Code Versioning and Forking
      • Code Licensing and Royalties
      • Code Marketplaces and Auctions
      • Code Search and Discovery
      • Flex Commons Governance using FLEXE
    • Ecosystem Tokens' Multi-Staking
    • Technical Roadmap for the Flex Ecosystem
      • Flex Virtual Machine (FVM)
      • Flex SDCK
      • re:Flex Smart Contract Language
    • Flex Improvement Proposal (FIP)
    • Flex Portal: Your Gateway to Web3
  • Contribute to the Ecosystem
    • Strategists: Roles and Contributions
    • Developers and Projects
  • Governance and Utility
    • Introducing the FLEXE Token (coming soon)
    • Flexonomics (coming soon)
    • How to get FLEXE tokens (coming soon)
      • Use the faucet (coming soon)
      • Run a node (coming soon)
  • Quicklinks
    • Supported Social Media
    • Official Website
  • Legal
    • Terms of Service
    • Privacy Policy
    • Digital Asset Disclosure (coming soon)
Powered by GitBook
On this page
  1. Protocol
  2. Flex Validator Nodes

Data and Validation Layer

Flex is a community-owned platform that rapidly boosts dApp user growth, ensuring the value generated directly benefits the Flex community.

The data and validation layer forms the cornerstone of the Flex Network, responsible for task execution, data processing, and primary validation.

Task assignment algorithm:

The task assignment process utilizes a complex algorithm that considers multiple factors to optimize network efficiency:

JavascriptcodeCopy codedef calculate_assignment_score(validator, task):
    C_t = task.complexity
    P_v = validator.performance_score
    A_v = validator.availability
    W_v = validator.stake_weight
    
    base_score = (P_v * A_v) / C_t
    reputation_factor = calculate_reputation_factor(validator)
    stake_factor = W_v ** 0.5
    
    return base_score * reputation_factor * stake_factor

def assign_task(task, validators):
    scores = [calculate_assignment_score(v, task) for v in validators]
    probabilities = softmax(scores)
    return np.random.choice(validators, p=probabilities)

The calculate_assignment_score function incorporates additional factors such as validator reputation and stake weight. The assign_task function uses a softmax distribution to introduce a degree of randomness while still favoring higher-scoring validators.

Peer validation determination:

The number of peer validators (N_t) required for a task is dynamically calculated based on the task's complexity and the network's current state:

Nt​=max(⌈C(t)∑v∈V​A(v)​⌉,⌊log2​(∣V∣)+CˉC(t)​⌋)N t ​ =max(⌈ C(t) ∑ v∈V ​ A(v) ​ ⌉,⌊log 2 ​ (∣V∣)+ C ˉ C(t) ​ ⌋)Nt​=max(⌈C(t)∑v∈V​A(v)​⌉,⌊log2​(∣V∣)+CˉC(t)​⌋)

where:

  • V is the set of all validators

  • A(v) is the availability of validator v

  • Cˉ is the average task complexity

This formula ensures that more complex tasks or tasks during periods of low validator availability receive more peer validations.

PreviousFlex Validator NodesNextRewards Layer

Last updated 10 months ago

We invite developers, researchers, and enthusiasts to work with our contributors for this section.

Start contributing here.