arnaucube
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Mina overview > *This document is an overview on Mina, done while reading/watching [Mina docs](https://docs.minaprotocol.com), [ZK Hack Mina talk](https://www.youtube.com/watch?v=bjSAf41PWWI), [Technical Whitepaper](https://docs.minaprotocol.com/static/pdf/technicalWhitepaper.pdf), and [Economics Whitepaper](https://docs.minaprotocol.com/static/pdf/economicsWhitepaper.pdf).* <div style="float:right;font-style:italic;margin-bottom:10px;">Research Group, 2022-02-10</div> <br> <div style="background: #f2f2f2;"> **Contents:** [TOC] </div> ## Main characteristics - Succint L1 blockchain - Recursive zkSNARKs in order to 'compress' the blockchain state into 22kb - Kimchi: Plonk + Plookup ### Comparison to Ethereum - Eth - on-chain computation - Mina - offchain computation + onchain verification - sent to network: state updates + zk-proof - (network) nodes verify the proof + updates state onchain - if zkproof verification fails tx is rejected ## Snapp Snapp: UI + SmartContract - SmartContract (Mina's SmartContract): - Prover function: runs locally (browser). Generates the zkProof - Verifications key: stored onchain to verify correctness of execution - Deploying the verification key to the chain creates a _"snapp account"_ - Snapp methods - Each method is compiled to a program which has: - Input: method's arguments and onchain values - other onchain contracts state, values from the state of the world (eg. BlockHeigh), etc - Output: list of updates to perform and a list of preconditions related to onchain state ![](https://i.imgur.com/A6OmeJW.png) ## SnarkyJS - SnarkyJS is the way to write 'Snapps' in Mina - Typescript library - runs in the browser - can use existing js/ts libs & tooling - can use the Typescript type system, including Generics! - can benefit from code editor's autocomplete features for Typescript - Example of addition of two field elements: - in js: `const sum = 1 + 3;` - in SnarkyJS: ```js const sum = new Field(1).add(new Field(3)); const sum = new Field(1).add(3); // same than previous line but simplier ``` - It has a bunch of 'standard lib' Typescript types (which internally are translated into constraint system) - Field, UInt64, UInt32, PublicKey, PrivateKey, Signature, Optional, Bool, ... - State can only be derived from Field type - The state (variables) of a Snapp are *public* unless explicitly stored as a commitment - any argument of a method is *private* (unless eg. the method stores an argument directly in the state) - Methods getting data from onchain, are *async* (using async/await js syntax) - as the method who needs to fetch the current state of the snapp is running offchain - Calling a method does: - given some preconditions - we compute the new state & generate the zkproof - send the zkproof onchain + new state - network verifies the zkproof + old state + new state - Anatomy of a smart contract - State variables (public) - Constructor: how contract can be deployed - Methods: updates & preconditions - args are private by default - Currently storage is onchain, but they have plans to have offchain storage - eg: root stored onchain, the rest of the tree stored offchain in a decentralized storage - SnarkyJS, the proof generation is WASM compiled from Rust code - Recursion: Combine 2 different zkProofs into a single zkProof ### Account balances - Mina has its own currency: Mina - Snapp account balance accessible through `.balance`: ```js // substract value from Snapp balance ('this' is inside the update method) this.balance.subInPlace(value); // add value to user balance user.balance.addInPlace(value); ``` - All balance changes in a tx must sum to 0 ### Multisig example - array of public keys (can be private) - not stored onchain, stored as contract parameter (offchain) - basically: - 1. check if signer is in the defined array of pubKeys - 2. check signature (& nonce non-reused) - 3. allow the sender to decrease the balance of contract - it is not public which pubK did a tx ## Mina Network - Roles: - Verifiers - request Merkle paths (of the part of the state which the Verifier cares about) and check them - Block producers - Similar to 'miners' or 'stackers' in other protocols - Incentivized by block rewards or fees paid by users - Note: block producers are not incentivized by the threat of slashing in order to participate (due Mina's consensus mechanism) - Individuals can stake, but also delegate their stake to another block producer - For each tx added into a block, BlockProducers must SNARK an equivalent number of previously added txs (enforced by the consensus) - they can produce those SNARKs themselves, or do it through specialized network participants: Snarkers - Snarkers - network participants who produce zkSNARKs that prove txs - Snarkers post fees for their work - if their SNARKs are used in a block, the BlockProducer pays fees to the Snarker from the total txs fees - BlockProducers have the incentive to 'hire' Snarkers with lower fees, while Snarkers want to get maximum fee amounts - This naturally forms a marketplace (aka. 'Snarketplace'), where participants compete to produce the most cost-efficient zkSNARK proofs. ## Other - There will be a Mina->Ethereum bridge - To verify inside an Ethereum SmartContract the Mina's state - The other direction (Eth->Mina, verify Ethereum state inside Mina contract) not in the near future - Mina zk 'tooling' is [Kimchi](https://github.com/o1-labs/proof-systems/tree/master/kimchi) - which uses [Plonk](https://eprint.iacr.org/2019/953.pdf) + [Plookup](https://eprint.iacr.org/2020/315.pdf) - Mina - payment system is account based system - consensus: PoS 'Ouroboros Samasika' ## Thoughts - Seems that Mina focus is to provide Snapps tooling similar to what Solidity ecosystem currently is - Abstracted from internals of zk, allowing devs to focus in the app level (similar to what Solidity does) - If Mina is choosen as platform by Aragon&Vocdoni, it might be worth to train the devs into knowing to write Mina Snapps (in the same way that currently they know to write Solidity contracts) - Some 'standard lib' components (circuits/gadgets) are implemented in Typescript as part of the SnarkyJS, but more computation demanding / complex ones are implemented directly in Rust (at Kimchi level) (similar to what 'precompiled opcodes' are in Ethereum's EVM) - Snapps are designed to run in the browser (inputs & proof generation) - Our initial use case is a zkRollup, which requires aggregating users txs/votes in a single proof by a server - The feeling is that is Snapps are focused for app devs, like Solidity, apps running in user browser. But not for running your own infrastructure - It could make sense to implement a DAO in a Snapp - Similar to multisig, but offchain (with Mina's onchain execution, so for Mina chain assets) - It would be like a 'L2/rollup DAO', where users can aggregate votes offchain (and the L1 would be Mina) - Although Mina's SnarkyJS can be used to build needed apps, we would need deeper analysis in terms of our roadmap to actually know our best fit. - As maybe depending on what we want to build it may make more sense to build it directly with [Circom](https://github.com/iden3/circom) (and other use cases would require more 'plonk' like stuff like [arkworks-plonk](https://github.com/ZK-Garage/plonk), [Plonky2](https://github.com/mir-protocol/plonky2) or [Halo2](https://github.com/zcash/halo2)) <!-- CSS hacks --> <style> /* CSS hack to add section numbers to titles, starting from h2.*/ /* Titles numbers */ .markdown-body h1 {counter-reset: h2} .markdown-body h2 {counter-reset: h3} .markdown-body h3 {counter-reset: h4} .markdown-body h4 {counter-reset: h5} .markdown-body h5 {counter-reset: h6} .markdown-body h2:before {counter-increment: h2; content: counter(h2) ". "} .markdown-body h3:before {counter-increment: h3; content: counter(h2) "." counter(h3) ". "} .markdown-body h4:before {counter-increment: h4; content: counter(h2) "." counter(h3) "." counter(h4) ". "} .markdown-body h5:before {counter-increment: h5; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". "} .markdown-body h6:before {counter-increment: h6; content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". "} .markdown-body h2.nocount:before, .markdown-body h3.nocount:before, .markdown-body h4.nocount:before, .markdown-body h5.nocount:before, .markdown-body h6.nocount:before { markdown-body: ""; counter-increment: none } .markdown-body h1:before, .markdown-body h2:before, .markdown-body h3:before, .markdown-body h4:before, .markdown-body h5:before, .markdown-body h6:before { color: #737373!important; } /* TOC numbers */ .toc ul li ul { counter-reset: section; list-style-type: none; } .toc ul li ul li::before { color: #919191!important; counter-increment: section; content: counters(section, ".") " "; } </style>

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully