-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update zkapp-development-frameworks.mdx #1072
base: main
Are you sure you want to change the base?
Conversation
update without decision tree image
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@JanSlobodnik is attempting to deploy a commit to the o1labs Team on Vercel. A member of the Team first needs to authorize it. |
|
||
::: | ||
Applications on Mina are called zkApps, and they come in a wide range of forms, including DeFi, games, state bridges, and more. However, due to Mina’s client execution model, the developer experience differs somewhat from that of other blockchain networks, such as Ethereum. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "client side execution model"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
</tr> | ||
<tr> | ||
<td>Please note that **Protokit is in alpha**, and settlement support with reorgs is still in progress. | ||
<p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no closing tag for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
<tr> | ||
<td>For developers coming from the Ethereum ecosystem, think of zkApps like smart contracts that can be verified off-chain. | ||
<p> | ||
This enables Mina to employ a client execution model, which gives Mina its scalability and privacy properties, but it can make it difficult to develop applications with concurrent users requiring a shared state. Protokit builds on top of o1js to solve these concurrency challenges. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: client side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
- [Developer documentation](/zkapps/o1js) | ||
- [o1js repository](https://github.com/o1-labs/o1js) | ||
- [Discord](https://discord.gg/minaprotocol) | ||
[o1js](https://docs.minaprotocol.com/zkapps/o1js) is the best way to author **highly-optimized ZK circuits and primitives**, but it does not provide an easy-to-use solution for managing a shared global state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OffchainState
provides an out-of-the box solution to this. It's worth mentioning here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o1js is also the only way to interfact directly with the protocol, its "not just" a tool for primitives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should highlight offchain state as a serious way to handle app state until it's out of the experimental namespace. I don't think we should make casual references to things in the docs until we're ready to stand behind them 100%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider this closed? Jan has address Florian's comment and we're not going to include mention of OffchainState.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not true that OffchainState is a solution to race conditions on "shared global state" as suggested above. It only solves this for user-specific state. The thing is that you can't concurrently compute over shared global state without any form of on-chain execution. That is why we built protokit, to add that possibility to the features already existing in o1js.
If you wanted to do the same with vanilla-o1js features and then polish the DX, solve other limitations in the process and then make the system efficient, you'd pretty much end up with protokit in based sequencing mode (which is the first mode we will ship)
1. Are you willing to trade off L1 censorship resistance and liveness guarantees for high throughput and low latency?* | ||
1. Yes - Hybrid mode | ||
2. No - Based mode | ||
2. No - o1js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Existence of OffchainState
makes this tree a bit complicated than this. It's true that OffchainState
is not scalable as base mode Protokit since it doesn't keep a db thus recreates the offchain state Merkle tree on-the-fly which creates an overhead. But, It's ready to use now (not production-ready) and worth mentioning in the tree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this closed.
|
||
# zkApp Development Frameworks | ||
Developers build zkApps with **o1js**. Developers can either use o1js directly or use o1js with **Protokit**, a framework built on top of o1js. Both options offer the full benefits of Mina’s verifiable, privacy-preserving zero knowledge proofs, but offer different tradeoffs between developer experience, performance, and decentralization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both options offer the full benefits of Mina’s verifiable, privacy-preserving zero knowledge proofs
Do they actually? Natively, afaik Protokit executes business logic on a server/"on-chain" - away from the client - this would render privacy-preserving not true in the default case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example from the protokit docs:
@runtimeModule()
export class Balances extends RuntimeModule<Record<string, never>> {
@state() public balances = StateMap.from(PublicKey, UInt64);
@runtimeMethod()
public mint(canMintProof: CanMintProof, amount: UInt64) {
canMintProof.verify();
this.balances.set(address, amount);
}
}
Seems like using a proof input would be a valid way of preserving privacy on protokit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not the default tho whereas with o1js it is, because everything happens locally on the clients machine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a difference between opt-in and opt-out so this needs to be highlighted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a Protokit runtime you can accomplish the same architecture patterns as with account updates, but you'll have an easier time customizing the on-chain protocol part, something that is not possible with a general purpose smart contract L1. So privacy is indeed optional, but that's actually a feature you can leverage, which mitigates the concurrency issues of current smart contracts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So privacy is indeed optional, but that's actually a feature you can leverage, which mitigates the concurrency issues of current smart contracts.
I am not saying it isn't a feature! But a big difference that users should be made aware of, especially since the default is on-chain execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is everyone ok to leave this as is? The statement is still correct - both frameworks allow for privacy. The details of how to implement for privacy can be left for deeper level docs. The key point to land here is that you can build a privacy-preserving app using either framework.
|
||
Protokit is built on top of o1js and simplifies the development of **zkApps with concurrent users requiring a shared state**, such as DEXes or games. Protokit is recommended for most developers. | ||
|
||
O1js is the best way to write **custom zero knowledge circuits** and construct low-level primitives on Mina, such as an NFT standard or a zkML library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o1js not O1js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
Developers can build zkApps either directly with **o1js**, or with **o1js** + **Protokit**. | ||
|
||
Protokit is built on top of o1js and simplifies the development of **zkApps with concurrent users requiring a shared state**, such as DEXes or games. Protokit is recommended for most developers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protokit is recommended for most developers.
is it? What's some examples when this is the case and when it isn't? If we recommend something we should clearly lay out the motivations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll remove "Protokit is recommended for most developers."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed (removed sentence)
</td> | ||
</tr> | ||
<tr> | ||
<td>For developers coming from the Ethereum ecosystem, think of zkApps like smart contracts that can be verified off-chain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zkApps aren't verified off-chain, they are proven off-chain and verified on-chain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
|
||
|
||
## Protokit[](https://docs.minaprotocol.com/zkapps/zkapp-development-frameworks#protokit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this link is broken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
- [Developer documentation](/zkapps/o1js) | ||
- [o1js repository](https://github.com/o1-labs/o1js) | ||
- [Discord](https://discord.gg/minaprotocol) | ||
[o1js](https://docs.minaprotocol.com/zkapps/o1js) is the best way to author **highly-optimized ZK circuits and primitives**, but it does not provide an easy-to-use solution for managing a shared global state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o1js is also the only way to interfact directly with the protocol, its "not just" a tool for primitives
|
||
## [Protokit](https://protokit.dev/) | ||
o1js can be used directly on the Mina L1, and is thus limited by the L1’s throughput and latency, but maintains strong decentralization guarantees. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good way to phrase this. o1js is a tool that lets you build whatever on top of Mina, you can build your own app-specific rollups that would not be limited by the L1s throughput.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @Trivo25, we should be clear in distinguishing the terminology between "general o1js" and "smart contracts / account updates"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
**Still can’t decide between Protokit and o1js?** | ||
|
||
This section provides a simple decision tree x`and comparison table to help zkApp developers choose which framework to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tree x`and
typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
![Decision Tree for zkApp devs](/img/decision-tree.png) | ||
|
||
Are you developing a zkApp with concurrent users requiring a shared state? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a fan of this decision tree. It ignores many details and will, imo in most cases, point developers to the wrong tools. We should educate devs on the benefits of both options, instead of assuming their use cases will just fit into one of two buckets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll remove the decision tree and leave the table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed decision tree, only table remains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the protokit documentation be moving to the mina protocol docs? The part about based vs. hybrid sequencing seems like it could be its own article in the protokit docs.
Overall, what message is this change intended to deliver? I think as-written it's in quite a confusing state where it pretty explicitly recommends protokit, but still makes references to o1js to be polite. If the goal is simply to say "protokit is the app development platform for Mina", this halfway approach seems too weak. If the goal is to say "o1js and protokit are two app development platforms for Mina", then I think we should remove recommendations for one or the other, and stick to the facts. I also think a factual approach will scale better when other frameworks are added.
Also, should we expect more similar PRs for docs pages as part of an effort to clean up the marketing, or is this a one-off?
@45930 yes the idea is to move the Protokit documentation to the Mina Protocol docs in the future. This update is intended to address one of the most common questions we've heard from devs when confronted with o1js and Protokit - which should I use? The intent was to land a few core messages:
The goal is to help devs choose whether to develop on o1js directly or Protokit on top of o1js. If you see specific areas that are confusing let's definitely clear them up. |
@andrewferrone Thanks for the reply!
I see! Yeah, it makes sense that people are confused by this, but I don't think there is a simple answer.
I love this message, no issues with this from my side
This seems overly prescriptive to me and it also puts a narrow view on the potential use cases for Mina. What if this message was re-written more as a comparison table that explains the properties of each option? I suppose the difference between this format and a decision tree is that it's more ambiguous and doesn't lead to a specific recommendation, but it gives devs a lot more direction about how to start making their decision. Maybe this is too many columns, but something like this, e.g.
|
@45930 did you see the comparison table at the bottom of the page? We can remove the decision tree.
|
update the doc with protokit and explanation for devs to know which one to select
This update is without the decision tree image, i need push access to add images.