Rising Tides: How The Mina Protocol Can Benefit Web 3.0

Rising Tides: How The Mina Protocol Can Benefit Web 3.0

Authored by Willem Olding

An examination of Mina's lightweight non-consensus full nodes and Rust x Wasm

ChainSafe is supremely honoured to have been awarded a grant to complete an implementation of the Mina Protocol in Rust. A big focus of our work will be implementing lightweight non-consensus full nodes which can run in Wasm environments. To understand why we are so excited about this, let's examine the current iteration of the Web 3.0 ecosystem and how it works today.

The current state of Web 3.0: trusted, rather than trust-less

MetaMask is by far the most common way for web users to bring Web 3.0 to their browsing experience. However, what few people realize is that the default mode in MetaMask does not interact with any blockchain directly (although you have the option to do otherwise). Queries of blockchain state are made through an infrastructure provider (hopefully running an honest node) with no additional validation performed by the client - they can tell you anything and you have to believe it. Needless to say, this was a design decision to enable a faster, more seamless experience.

While MetaMask is an incredible tool with excellent UX that ushered in unparalleled adoption of Web 3.0, its promises of decentralization still fall short of the ideals of the Web 3.0 vision. What is really needed is the ability for users on browser and mobile to verify state and transactions without having to trust a third party.

There is a proposed solution for validating state queries in-browser: light clients.

Instead of connecting to one (hopefully) honest node, a light client is connected to many nodes. However, only one of them must be honest and not withholding blocks from you. The light-client node syncs only the headers of blocks, which is enough to verify the chain selection rules for the contents of the state.

However, an issue with light clients is that they are often not so light. The collection of all headers for any popular blockchain is going to be a large amount of data to retrieve and store. A less than ideal prospect for new users on browser and mobile platforms. Strategies such as snapshots exist but require some level of compromise on trust compared with syncing and verifying the header chain.

Enter Mina's lightweight non-consensus full nodes.

Representing an entire blockchain using Mina's succinct cryptographic proofs

What the ChainSafe team will achieve at the end of implementing the Mina Protocol in Rust will be lightweight non-consensus full nodes. While that might be a bit of a mouthful, we can break it down as such:

  1. Lightweight - lighter than your conventional light clients, which can run in mobile, in-browser, or embedded environments like IoT devices.

  2. Non-consensus - client software that can check the balances of specific accounts and submit transactions to the network, but not participate in building finality for state transitions.

  3. Full nodes - in Mina terms, non-consensus full nodes carry the same security guarantees of a traditional full node, without the overhead. In typical scenarios, full nodes are client software that fully validates transactions and blocks in a network. Since it verifies all consensus parameters and synchronizes the entire transaction history of a distributed ledger, it is considered the most secure client software interacting with any blockchain.

Through the use of recursive SNARKs, the entire Mina blockchain can be summarized in a constant-sized succinct proof. This is sufficient to verify the validity of the chain up to the current block without the need to verify the entire header chain. As such, Mina makes a great leap forward in its design. This brings us much closer to the goal of a lightweight, trustless blockchain environment that can run in-browser, on mobile, or even inside another blockchain's state transition function to enable a trustless bridge.

A great explanation of Mina's succinct cryptographic proofs, which can represent the entire blockchain, can be found in their blog post 22kb-Sized Blockchain - A Technical Reference.

Rust x Wasm

The final missing link to realizing this dream is a portable and secure runtime for a succinct cryptographic proof. This is where WebAssembly (Wasm) really shines. Wasm is a low level language with a compact format and strong links to machine code instructions. It is a technology that is seeing increasing adoption in the blockchain space, and is commonly used as an alternative to the EVM as a runtime for smart contracts.

However, this is far from its only use. Wasm was jointly developed by Mozilla, Google, Apple, and the W3C as a way to run complex, sandboxed applications in browser and mobile environments, which makes it perfect for verifying computationally expensive and sophisticated SNARK proofs in a safe execution environment. The performance achieved would be on par with running software natively.

Wasm is memory safe, platform independent, and maps well to all types of CPU architectures efficiently. Its flexibility makes it a great choice for blockchain runtimes, and is already a compilation target for many chains, most notably Polkadot.

An implementation of Mina in Rust, the best suited language for targeting Wasm, is essential to reach the goal of Mina as a blockchain that is accessible from anywhere - without requiring trusted intermediaries and with a sync time measured in milliseconds.

Updates from the ChainSafe fam:

🎉 The Mina x Rust Github repo is now public! You can follow along our open-source codebase[ her](https://github.com/ChainSafe/mina-rs)e and here. 🎉

Our VP of Engineering, David Ansermino, gave the Mina community an update at the Mina Community Spotlight Event on June 25, 2021. He ran through the three engineering goals of the Rust implementation team, and re-emphasized the roadmap for development. You can check it out here:

Head of Protocol Implementation Elizabeth Binks also gave a rapid-fire update on the Mina team's progress so far at the Mina Ecosystem Update #1 on July 2nd, 2021. Check it out below:

Finally, we are extremely excited to finally give ChainSafe's Rust implementation of the Mina Protocol a cool name and project-specific branding. We are already mulling over a few prospective names, and rest assured they will sound just as dope as our other client implementation projects like Lodestar (Eth2), Gossamer (Polkadot), and Forest (Filecoin)!

Get involved

To learn more about Mina, be sure to visit their website!

Want to work with ChainSafe? COME JOIN US!!! Check out the new Careers section of our website and our open positions, and get in touch with us at careers@chainsafe.io if you are interested!

Also, be sure to check out and follow ChainSafe's Twitter and YouTube Channel! If you would like to get in contact with one of the Mina implementation team members from ChainSafe, feel free to drop by on our Discord.

Finally, subscribe to our Medium and follow closely on our website and Github for the latest updates!

Acknowledgements

Thank you to Tim Ho, Rahul Sharma, David Ansermino, and Aidan Hyman. Their contributions were invaluable to the making of this article.