Skip to content

Latest commit

 

History

History
107 lines (89 loc) · 3.34 KB

README.md

File metadata and controls

107 lines (89 loc) · 3.34 KB

Smart Contracts

  • Country-Wise Decentralized Contract

    • ✅ Minimal implementation for the demo
  • ZKML

    • ✅ MultiLayer Perceptron (Neural Network)
    • ❌ Convolutional Neural Network
      • Requires to implement the following layers
        • Flatten, Conv2D, MaxPooling
      • Add the following examples :
        • Crater identification (availible datasets on kaggle)
    • ❌ Graph Attention Network (Neural Network)
      • Cannot be implemented on regular pipe
        • pipe : Labeled_Graph_Input $\to \dots \to$ Labeled_Graph $\to \dots \to$ Integer
      • Add the following examples :
        • Constellation identification
          • Requires a first model to extrapolate stars positions and size.
          • Normalized graph labeled with distances and star sizes.
  • Fully Decentralized Contract

    • Able to do predictions.
    • ❌ Minimal implementation for the demo

Installation

Requires : Scarb, Cairo

Execution

Compilation :

scarb build

Tests :

scarb test

We recommand you to declare/deploy using Argent :

# EXAMPLE CALL DATA :
10, # max_propositions
10, # min_filtered

3, # n_countries
0,
1,
2,

3, # initial_validators
0x93...,
0x93...,
0x93...,

3, # initial_validators_countries
0,
1,
2,

# initial_weights : AUTOGENERATED in /contract/draft/model_weights.save

Sepolia execution with a configured starkli :

# TO DECLARE THE CONTRACT :
starkli declare target/dev/  [TODO] .json --compiler-version=2.4.0
# or
starkli declare target/dev/<WANTED_CONTRACT>.json --compiler-version=2.4.0

# TO DEPLOY THE CONTRACT (ie. generate an instance) :
starkli deploy <CONTRACT_ADDRESS> <constructor as felt252>
# METHODS WITHOUT SIDE EFFECTS (READ ONLY) :
starkli call <CONTRACT_ADDRESS> <method> <arguments as felt252> 
# METHODS WITH SIDE EFFECTS :
starkli invoke <CONTRACT_ADDRESS> <method> <arguments as felt252> 

Code details

The following basic features doesn't exists in the last stable version of Cairo :

  • Signed integer (eg: int)
    • I use the not supported i128 type.
    • It requires to be converted to felt252 when communicating with RPC
    • It requires to reimplement basics interfaces
  • Float
    • Starkware's team recommended me to use either :
      • alexandria or zkfloat
    • I instead use my own struct WFloat
  • Lambda
    • 12/07/24 : Unfortunaly not merged on the official Cairo repos (PR link)
    • My OOP Approach with interface (link)
  • Basic Linear Algebra (Vector + Matrix)
    • I implements them myself.
    • Smart contract integration
      • 12/07/24 : Merged 3 days ago by Starkware, but unfortunaly not availible on starknet yet (PR link)
      • I will have to do it the "dirty" way.
    • Vector
    • Matrix