Gradients #3: An MVP For The Mina Community

Gradients #3: An MVP For The Mina Community

Authored by Timothy Hao Chi Ho

An update from the Mina team on our progress from Q1 and Q2 2022

Mina-rs is ChainSafe's Rust implementation of the Mina Protocol, originally written in OCaml. Mina-rs, a tentatively named project, was awarded to ChainSafe through a community grant from the Mina Foundation in May 2021. You can learn more from our official announcement [here](https://medium.com/chainsafe-systems/realizing-the-mina-vision-in-rust-453f6f522205) and get up to speed via our community updates here.

Hello 👋 , it's been a while since our last update from the Mina-rs team.

Since we originally took on the grant to produce an alternative, non-consensus (i.e., non-block producing) implementation of the Mina Protocol in Rust, a lot has happened - or rather, not happened. One thing both the Mina Foundation, O(1) Labs, and ChainSafe teams did not anticipate with the original scope of the Mina implementations (both OCaml and Rust) was how complex and challenging the work would be.

More than that, core protocol work involving multiple teams can often be a multi-front operation. Critical dependencies can hinder meaningful progress from all sides. And ongoing research and internal discussions can change the scope of work significantly. Some work may go unused, yet others may only be usable further along in development. For now, we must push ahead on other axes.

In collaboration with the rest of the teams working on Mina, we elected instead to deliver something quickly for the community. This means a smaller and faster version of our original work on non-consensus Rust nodes.

An MVP for the Mina Community

ChainSafe is now working towards a minimum viable product (MVP) for non-consensus nodes. We will still be building an additional implementation of Mina in Rust, albeit simpler.

The node will still be able to provide users with direct access to the Mina network via web and mobile i.e. it can run on consumer-grade hardware. And as previously mentioned, it will not produce blocks nor participate in consensus for the network.

Imagine a Mina browser extension with a web GUI, downloadable from any web app store. The extension would act as an in-browser node - meaning it will be capable of:

  • Downloading blocks

  • Checking the state of the chain

  • Validating proofs

  • Executing the verification process (as a full node would)

  • Tracking a small subset of accounts (~100) that any given user might be concerned with

  • Signing and sending transactions via a wallet integration, and

  • Configuring the extension with a list of trusted API endpoints

In essence, the MVP should be able to participate in the Mina network as a "lite" version of a non-consensus node.

Restructuring of the Original Scope

There are slight changes to the original scope of our work to enable an MVP version. These are the important distinctions:

We will now use GraphQL API's for networking instead of libp2p

  • This is quicker to implement from an MVP perspective.

The node will not produce snarks for block verification

  • The original intent was to deliver this for milestone 3

We will add JSON serialization to serialize/deserialize blocks

  • JSON is the block format for GraphQL API's

We will work on an Auro Wallet integration

  • Auro Wallet is currently the main web wallet in the Mina ecosystem

Five Objectives

To ensure timely delivery of the MVP version of Mina-rs, we have five key objectives. They can be worked on in parallel:

  1. Bin-prot wire protocol support + JSON serialization: As discussed in a previous blog, bin-prot is the wire protocol through which Mina nodes exchange messages over the network This is a carryover from the original scope. With the new GraphQL requirement, JSON serialization must be supported as well.

  2. Non-consensus browser node: The web node must be a lightweight non-consensus client that can run as a single-page app or as a Chrome extension.

  3. Network support, state sync, and block verification: Must allow the web node to consume data from Mina's mainnet and sync the chain state.

  4. Chain selection: The web node should select the best chain given multiple competing or malicious chains.

  5. Storage, Ledgers, and transactions: Support for a compatible Merkle data tree structure to efficiently query account or transaction data from a Mina node. The Auro web wallet integration should then be able to sign and send transactions from the browser node.

You can view more details, including changes to other parts of the protocol, from the new Mina Ecosystem Roadmap (released May 17, 2022).

What has been completed so far?

Serialization and deserialization of Mina blocks in bin-prot and JSON is complete. Chain selection and fork choice rules are also done pending a final review and security audit. The non-consensus browser node work is done, pending design UX mock-ups from O1 labs.

Once we are given the GraphQL APIs, we will integrate them with the requisite back-ends. We will also soon be implementing the sparse Merkle ledger in order to have the naive node be able to track a small subset of accounts.

We will then move onto the networking abstraction layer to support multiple back-ends, including libp2p, GraphQL v1, GraphQL v2. Multi-backend support is unique to our implementation since our original scope specified support for libp2p only, before GraphQL became a requirement. Finally, work will begin soon on the Auro Wallet integration.

Once we can clear the main GraphQL API hurdle, a lot of work becomes unlocked! Exciting times ahead for the dev team :)

Introducing the Mina-rs team

Implementing the Mina Protocol is no easy feat. Doing it in Rust is another story. We are humbled and privileged to have talented Rust developers working on our team to make the dream of a lightest blockchain in the world in Rust a reality.

At this time, we'd like to introduce and recognize the core contributors on the Mina-rs team. We have also attached their Github handles. Don't hesitate to fire away any questions to them if you have any:

On MetaMask's MinaSnap

In other news, the ChainSafe Croatian team won a prize in the Mina Protocol track at the ETHAmsterdam hackathon! They were awarded 2nd place for building MinaSnap, a MetaMask Snap integration for the Mina network.

You can think of Snaps as plugins for MetaMask, albeit in an experimental stage and meant purely for developers to tinker with. Nevertheless, it was groundbreaking work opening up the MetaMask web wallet ecosystem to the Mina ecosystem.

So much so that there are now further conversations for improving the performance of, and building out the MinaSnap integration. As the hackathon version of MinaSnap utilizes a mina-signer library that's 3.5mb in size and likely compiled to JavaScript from OCaml (plus bits of hacky code), the performance has a lot left to be desired. Consequently, the integration performs poorly in the MetaMask sandbox engine.

Given the potential of the MinaSnap integration for extensibility, a mina-signer library in WebAssembly (wasm) in native Rust would be something a Mina Rust team would be super well suited for 🤔🤔🤔. Stay tuned for more on this.

To learn more about MetaMask Flask, Snaps, and the original FilSnap integration we built for Filecoin, check out our original blog post [here](https://blog.chainsafe.io/extending-metamask-a-snap-for-filecoin-692fc5998c0b). We have also since signed a Web3 Foundation grant to extend this functionality to Substrate-based ecosystems. You can also learn more from our SubstrateSnap blog here.

Around the Mina x ChainSafe Ecosystem

Anon, were you at CSCON1, ChainSafe's 3-day virtual summit for blockchain and web3? If you were not, you missed out on some great presentations that featured key players from the Mina ecosystem!

Luckily for you, all of their talks were recorded and posted on ChainSafe's YouTube. You can view them retroactively here. We have also listed them out below for your viewing pleasure.

Mina-rs' Project Manager Lerna Jabourian gave a great overview of ChainSafe's work on Mina-rs so far (before the scope changes):

CEO of Mina Foundation and co-founder of the Mina Protocol Evan Shapiro stopped by to present us a path towards privacy and verifiability in web3:

Core Engineers Joseph Spadavecchia and Brandon Kase dove deep into Ouroboros Samasika Consensus and the engine that runs behind the Mina Protocol:

Mina's Community Champion Christine Yip gave an insightful talk on how to bootstrap communities in web3:

Finally, Mina's Design Lead and now Creative Director Kate El-Bizri shared some of her philosophies on design in web3 and how it informs her gradients-inspired approach to designing Mina:

Around the ecosystem, Joseph Spadavecchia and David Wong gave a great talk on Mina's newest SNARK tech: Kimchi at zkSummit 7 in Amsterdam in April 2022. It brings faster verification and prover time than the previously used PLONK SNARK. Check it out here:

About ChainSafe

ChainSafe is a leading blockchain research and development firm specializing in infrastructure solutions for the decentralized web. Alongside client implementations for Ethereum, Polkadot, Filecoin, and Mina, we're building a portfolio of web3 products - Files, Storage, the Gaming SDK, and ChainBridge. As part of our mission to build innovative products for users and better tooling for developers, ChainSafe embodies an open source and community-oriented ethos. To learn more, click here.

Website |Twitter |Linkedin |YouTube |GitHub

Acknowledgments

Thanks to Colin Adams, Lerna Jabourian, and Hailong Mu for their contributions to this article.

Read more