Resource

A New Zero-Knowledge Smart Contract that Verifies Trade Profit Percentage, Proof of Alpha — zkApp in Development Now

Mina ecosystem partner, o1Labs shares a new zkApp they are developing and how it will work.
By: Regina Wong, o1Labs Developer Relations Engineer, Mina Protocol Contributor 

During our zkApps ideation workshop last year, participants gathered to brainstorm zkApps use cases. One of the ideas proposed was a zkApp to trustlessly prove crypto trading performance.

On Crypto Twitter, investors frequently post screenshots to boast about their trading performance. However, with Photoshop and other editing platforms, it’s easier than ever to falsify trades. With the power of zero-knowledge proofs, a trader can prove their trade performance (as % profit) to others without disclosing their private information, such as the amount of funds traded.

Recognizing the power of proving and verifying one’s trading track record, our team decided to build a zkApp for it.

What are zkApps?

zkApps (“SNARK apps”) are Mina’s zero-knowledge-powered smart contracts. 

They are a type of decentralized application (dapp) that uses cryptography to prove knowledge without revealing all pieces of information. More specifically, zkApps use the power of zk-SNARKs, or zero-knowledge Succinct Non-interactive Arguments of Knowledge, to let users control data on their own terms. You can find more details about the scalability and privacy features of zkApps in the official docs, video, and blog post.

There are many use cases for zkApps. You can verify your credit score without revealing your social security number or prove your ownership of a property without sharing your identity. The list goes on and can be applied to DeFi, NFTs, etc. For now, we will start with Proof of Alpha where you can prove your trading profit % without sharing the amount of funds traded. 

What is Proof of Alpha?

Proof of Alpha is how we refer to our zkApp that verifies profit percentage on cryptocurrency or stock trades. In our particular application, we will be focusing on cryptocurrency.

In the finance industry, wealth advisors and investors commonly share information about the performance of their investments or the profitability of their trades to prove credibility or share accomplishments. With the influx of investing influencers on social media, it’s now especially common for individuals to share screenshots of their trading brokerage accounts, such as in the examples below:

Two ways of showing trade profits Sources: Reddit and CoinDesk

However, sharing trading history online comes with risks. An investor who shares a trade publicly may reveal the amount of assets they own as well as where their assets are stored. This can make the owner of this trade a target for malicious attacks.

Example of a tweet showing someone’s trades

Sharing trading history also puts the general public at risk. Since digital images are forgeable and difficult to verify, it’s easy to share false information about past trades. This can mislead people and put them at risk to make poor financial decisions.

Why We Are Building This

There are many ideas for zkApps that will benefit greatly from Mina’s scalability and privacy. In this case, our Proof of Alpha zkApp provides a new way for the cryptocurrency community to share historical financial returns without revealing the exact amount involved. It provides privacy as well as legitimacy for users on social media.

While the target users for this zkApp will mainly be cryptocurrency investors for entertainment or content purposes, this zkApp shows the power of being able to prove something without revealing related sensitive information, such as the amount of funds one owns.

How It Works

The Proof of Alpha zkApp lets anyone prove and verify trade profit % made on an exchange. For this initial version, our zkApp will be proving trading profit % for trades made on Binance.

Here’s how the zkApp works:

Step 1 – Enter your API key, found in your account profile on Binance, to pull your trade history from the exchange. This zkApp uses a read-only function with the minimal permission required to pull trade history. In other words, Binance will only share trading data with the zkApp. The zkApp cannot access your personal information, make trades, or take any other actions on your account.

With zkApps, developers can leverage private, verified, real-world data from any website to build decentralized apps.
With zkApps, developers can leverage private, verified, real-world data from any website to build decentralized apps.

Step 2 – Select your trade’s token pair (e.g. BTC-USDT) and date range. Using the API key, the zkApp will pull your trading history and generate a proof for your cumulative profit %. Next, it will send a zkApp transaction containing the proof to the Mina blockchain.

A preview of what the Proof of Alpha zkApp may look like

Step 3 – After sending the zkApp transaction, containing the proof, to the Mina network, the Mina network will verify the proof. If the proof is valid, the transaction will be accepted by the Mina network.

While this is happening, the zkApp generates a tweet that you can share on social media. The tweet contains an image that shows your proven trade profit % without revealing any sensitive information, such as the amount traded.

The image generated by Proof of Alpha zkApp

Step 4 – Any follower can verify your claim by clicking the link in your tweet. The link goes to a page on the zkApp that can provide more details about your trade as well as a link to see the zkApp transaction on Mina Explorer. Followers can see whether the transaction was accepted or rejected. If the transaction is accepted, it means your trade profit % claim is true. 

This a preview of what the zkApp may look like. Your followers can verify your trade profit % from this page by checking if a zkApp transaction containing the proof for this trade was accepted by Mina network.

Future Implications

The initial goal behind building this zkApp is to build something everyone can use to experience the power of zero-knowledge proofs.

Having a zkApp that verifies trading profit % can help influencers gain respected credit. Eventually, we hope Mina can empower anyone to verify and prove something without revealing related sensitive information such as health records, personal identification records, voting records, and more. 

Next Steps

We have an internal version of the Proof of Alpha application and are now working to release it to the developer community as a reference zkApp. Alongside this particular zkApp, we are working hard to implement learnings from the recent zkApps Bootcamp to improve the overall developer experience with better documentation and to optimize o1js (formerly SnarkyJS), the TypeScript library for writing zkApps.

Interested dapp developers can start learning how to build, write, and deploy zkApps like this Proof of Alpha zkApp in this workshop recording. You can also learn more about zkApps and follow the developer documentation here.

Keep up to date on all zkApps news by subscribing to the Mina Protocol newsletter.

About Mina Protocol

Mina is the world’s lightest blockchain, powered by participants. Rather than apply brute computing force, Mina uses advanced cryptography and recursive zk-SNARKs to design an entire blockchain that is about 22kb, the size of a couple of tweets. It is the first layer-1 to enable efficient implementation and easy programmability of zero knowledge smart contracts (zkApps). With its unique privacy features and ability to connect to any website, Mina is building a private gateway between the real world and crypto—and the secure, democratic future we all deserve.

More from our Blog

SEE ALL POSTS
Community,Events / 2024-11-07 / Mina Foundation
BUIDL with Mina Protocol at ETH Bangkok 2024
Are you ready to explore the power of zero knowledge? Join members of the Mina Ecosystem at this year’s ETH Seoul
Read more
Learn / 2024-11-04 / David Park
STOs and Real-World Assets on Mina
Read more
Learn / 2024-10-29 / Chris Song
Zero-knowledge Machine Learning on the Mina Protocol
Read more
Announcement / 2024-10-25 / Mina Ecosystem Contributors
Mina Ecosystem Gears Up for Beta Testing Phase
Read more

About the Tech

AboutTechCta

Mina uses advanced cryptography and recursive zk-SNARKs to deliver true decentralization at scale.

Get Started

GetStartedCta

Getting started with ZK on Mina is simple.

Cookie Consent with Real Cookie Banner