🗂️
Module Library
  • Governance Modules Library Overview
    • Projects using the Governance Modules
  • Power Attribution
    • Neural Governance
      • Specification
      • Implementation Instructions
      • Tuning Guidelines
      • Simulations
  • Signalling Forms
    • Quorum Delegation
      • Specification
      • Implementation Instructions
      • Tuning Guidelines
      • Simulations
  • Reputation Metrics
    • Trust Graph Bonus
      • Specification
      • Implementation Instructions
      • Tuning Guidelines
      • Simulations
  • Identity Management
    • Tier-based Role Certifier
      • Specification
      • Implementation Instructions
      • Tuning Guidelines
      • Simulations
Powered by GitBook
On this page
  1. Power Attribution
  2. Neural Governance

Implementation Instructions

PreviousSpecificationNextTuning Guidelines

Last updated 1 year ago

Authors: BlockScience and SDF, July 2023

The implementation of NG relies on two main premises - refactoring existing Neurons and creating new ones.

A PoC implementation in Rust for Soroban by Alejo Mendoza, Karol Bisztyga and Mateusz Kowalski is located in the GitHub repository. It implements the Neural Governance, Quorum Delegation and the Trust Graph Bonus governance modules.

A technical summary for learnings when implementing an MVP version of Neural Quorum Governance on SCF can be found on a post by : .

1) Decide on Neurons to be included

pub fn add_neuron( &mut self, layer_id: u32, // specifies the layer neuron: NeuronType // specifies the neuron )

  • The example implementations provide various Neurons as examples, among them:

    • Reputation through badges

    • Past Voting History

    • Trust Bonus

    • Additionally, new Neurons can be created (expanded on below).

2) Decide on aggregators to be included

pub fn set_layer_aggregator( &mut self, layer_id: u32, // specifies a layer ID aggregator: LayerAggregator, // specifies the aggregator to use )

  • Each layer of Neurons has their own aggregator and can be arbitrarly set per layer. Standard aggregators include Sum, Product and Mean.

3) Decide on the Neural Layering (CHECK ordering)

pub fn add_layer( &mut self, env: Env )

pub fn remove_layer( &mut self, layer_id: u32 )

  • Adding and removing layers allows to set aggregators and neurons correctly.

  • While Neurons within a layer are independent of ordering, deciding the order of layers changes the input a layer starts with, with it changing the outputs.

4) Decide on the Neuron weights & parameters (if applicable)

pub fn set_neuron_weight( &mut self, layer_id: u32, // specifies the layer neuron: NeuronType, // specifies the Neuron weight: DecimalNumber, // sets the weight )

  • Each Neuron can be weighted independently through their respective weight function. Some Neurons might also include parameters to adjust, such as Quorum Sizes and tresholds for Quorum Delegation.

5) Implement oracle functions if needed

  • Some Neurons require as input outside data, such as badges collected or past voting history.

6) Implement base module

7) Implement new neurons

  • fill the oracle_function of the new neuron with your custom logic

    • add a field of your Neuron to the NeuronType enum

    • add a case of your Neuron to the neuron_type_from_str function

8) Execute Neural Governance:

pub fn execute_neural_governance( &self, env: Env, voter_id: String, // specifies the voter_id for which NG is executed submission_id: String, // specifies the project for which NG is executed )

Neural Governance requires structure around the layering and Neurons. Receiving the votes, feeding them through the mechanism and then tallying the votes needs to be set up correctly. An example for instructions to set this up can be found .

Additionally, any new Neurons can be developed and included (example instructions from ):

Add a new file to - the new Neuron has to have oracle_function, the easiest way to go is to just copy the contents of the

add your Neuron module to the

in

add a case for your Neuron in the execute_layer function in

voting-poc
Karol Bisztyga
SCF Voting Mechanism Implementation
here
here
the neurons folder
dummy neuron
mod file
types
the layer file