diff --git a/docs/img/get-started/account-a.png b/docs/img/get-started/account-a.png new file mode 100644 index 000000000..4d01f73a5 Binary files /dev/null and b/docs/img/get-started/account-a.png differ diff --git a/docs/img/get-started/account-b.png b/docs/img/get-started/account-b.png new file mode 100644 index 000000000..b85107c31 Binary files /dev/null and b/docs/img/get-started/account-b.png differ diff --git a/docs/img/get-started/commit-height.png b/docs/img/get-started/commit-height.png new file mode 100644 index 000000000..9051a8e06 Binary files /dev/null and b/docs/img/get-started/commit-height.png differ diff --git a/docs/img/get-started/miden-account-list.png b/docs/img/get-started/miden-account-list.png new file mode 100644 index 000000000..84cb13643 Binary files /dev/null and b/docs/img/get-started/miden-account-list.png differ diff --git a/docs/img/get-started/note-view.png b/docs/img/get-started/note-view.png new file mode 100644 index 000000000..c44c12780 Binary files /dev/null and b/docs/img/get-started/note-view.png differ diff --git a/docs/img/get-started/two-accounts.png b/docs/img/get-started/two-accounts.png new file mode 100644 index 000000000..dc2de02af Binary files /dev/null and b/docs/img/get-started/two-accounts.png differ diff --git a/docs/img/get-started/view-account-vault.png b/docs/img/get-started/view-account-vault.png new file mode 100644 index 000000000..e2eeaa9f6 Binary files /dev/null and b/docs/img/get-started/view-account-vault.png differ diff --git a/docs/introduction/get-started/create-account-use-faucet.md b/docs/introduction/get-started/create-account-use-faucet.md new file mode 100644 index 000000000..f683b42ff --- /dev/null +++ b/docs/introduction/get-started/create-account-use-faucet.md @@ -0,0 +1,158 @@ +In this second, we show you how to create a new local Miden account and how to receive funds from the public Miden faucet website. + +## Configure the Miden client + +The Miden client facilitates interaction with the Miden rollup and provides a way to execute and prove transactions. + +!!! tip + Check the [Miden client documentation](https://docs.polygon.technology/miden/miden-client/cli-reference/) for more information. + +1. Clone the Miden client. + + ```shell + git clone https://github.com/0xPolygonMiden/miden-client + ``` + +2. Navigate to the client directory. + + ```shell + cd miden-client + ``` + +3. Modify the configuration file at `./miden-client.toml` to point to the remote Miden node. + + In the `[RPC]` section, replace the `endpoint = { host: }` field with the address provided by the Miden team. + + ```toml + [rpc] + endpoint = { protocol = "http", host = "", port = 57291 } + + [store] + database_filepath = "store.sqlite3" + ``` + +4. Build and install the client using cargo: + + ```shell + cargo install --features testing,concurrent --path . + ``` + +5. Check you can use the help flag. + + ```shell + miden-client --help + ``` + +## Create a new Miden account + +1. Create a new account called `basic-immutable` using the following command: + + ```shell + miden-client account new basic-immutable + ``` + +2. List all created accounts by running the following command: + + ```shell + miden-client account -l + ``` + +3. You should something like this: + + ![Result of listing miden accounts](../../img/get-started/miden-account-list.png) + +Save the account ID for a future step. + +## Request tokens from the public faucet + +1. To request funds from the faucet navigate to the following website: [Miden faucet website](https://ethdenver.polygonmiden.io/). + +2. Copy the **Account ID** printed by the `miden-client account -l` command in the previous step. + +3. Paste this id into the **Request test POL tokens** input field on the faucet website and click **Send me 100 tokens!**. + +4. After a few seconds your browser should download - or prompt you to download - a file called `note.mno` (mno = Miden note). It contains the funds the faucet sent to your address. + +5. Save this file on your computer, you will need it for the next step. + +## Import the note into the Miden client + +1. Import the note that you have received using the following commands: + + ```shell + miden-client input-notes -i + ``` + +2. You should see something like this: + + ```sh + Succesfully imported note 0x0ff340133840d35e95e0dc2e62c88ed75ab2e383dc6673ce0341bd486fed8cb6 + ``` + +3. Now that the note has been successfully imported, you can view the note's information using the following command: + + ```shell + miden-client input-notes -l + ``` + +4. You should see something like this: + + ![Result of viewing miden notes](../../img/get-started/note-view.png) + +!!! tip "The importance of syncing" + - As you can see, the listed note is lacking a `commit-height`. + - This is because you have received a note off-chain but have not yet synced your view of the rollup to check that the note is valid and exists at the rollup level. + - The nullified check at the operator level prevents double spends after a transaction takes place. + - Hence, before consuming the note we will need to update our view of the rollup by syncing. + +### Sync the client + +Do this periodically to keep informed about any updates on the node by running the `sync` command: + +```shell +miden-client sync +``` + +You will see something like this as output: + +```sh +State synced to block 179672 +``` + +## Consume the note & receive the funds + +1. Now that we have synced the client, the input-note imported from the faucet should have a `commit-height` confirming it exists at the rollup level: + + ```shell + miden-client input-notes -l + ``` + +2. You should see something like this: + + ![Viewing commit height info](../../img/get-started/commit-height.png) + +3. Find your account and note id by listing both `accounts` and `input-notes`: + + ```shell + miden-client account -l + miden-client input-notes -l + ``` + +4. Consume the note and add the funds from its vault to our account using the following command: + + ```shell + miden-client tx new consume-notes + ``` + +!!! tip + - You only need to use the first 7 characters of the Note-Id. + +5. View your updated account's vault containing the tokens sent by the faucet by running the following command: + + ```shell + miden-client account show -v + ``` + +6. You should now see your accounts vault containing the funds sent by the faucet. + + ![Viewing account vault with funds](../../img/get-started/view-account-vault.png) \ No newline at end of file diff --git a/docs/introduction/get-started/p2p-private-offchain-txs.md b/docs/introduction/get-started/p2p-private-offchain-txs.md new file mode 100644 index 000000000..8fbfccf26 --- /dev/null +++ b/docs/introduction/get-started/p2p-private-offchain-txs.md @@ -0,0 +1,100 @@ +In this section, we show you how to make off-chain transactions and send funds to another account using the Miden client. + +!!! important "Prerequisite steps" + - You should have already followed all previous sections. + - You should have *not* reset the state of your local client. + +## Create a second account + +!!! tip + Remember to use the [Miden client documentation](https://docs.polygon.technology/miden/miden-client/cli-reference/) for clarifications. + +1. Create a second account to send funds with. Previously, we created a `basic-immutable` (account A). Now, create `basic-immutable` (account B) using the following command: + + ```shell + miden-client account new basic-immutable + ``` + +2. List and view the newly created accounts with the following command: + + ```shell + miden-client account -l + ``` + +3. You should see two accounts: + + ![Result of listing miden accounts](../../img/get-started/two-accounts.png) + +## Transfer assets between accounts + +1. Now we can transfer some of the tokens we received from the faucet to our second account B. + + To do this, run: + + ```shell + miden-client tx new p2id 50 + ``` + + !!! note + The faucet account id can be found on the [Miden faucet website](https://ethdenver.polygonmiden.io/) under the title **Miden faucet**. + + This generates a Pay-to-ID (`P2ID`) note containing `` assets, transferred from one account to the other. + +2. First, sync the accounts. + + ```shell + miden-client sync # Make sure we have an updated view of the state + ``` + +3. Get the second note id. + + ```sh + miden-client input-notes list + ``` + +4. Have the second account consume the note. + + ```sh + miden-client tx new consume-notes + ``` + + !!! tip + It's possible to use a short version of the note id: 7 characters after the `0x` is sufficient. + +That's it! + +You should now see both accounts containing faucet assets with half the amount transferred from `Account A` to `Account B`. + +!!! tip + Remember. The original amount was 100 POL. + +Check the second account: + +```shell +miden-client account show -v # Show account B's vault assets (50 fungible tokens) +``` + +![Result of listing miden accounts](../../img/get-started/account-b.png) + +Check the original account: + +```sh +miden-client account show -v # Show account A's vault assets (950 fungible tokens) +``` + +![Result of listing miden accounts](../../img/get-started/account-a.png) + +## Clear state + +All state is maintained in `store.sqlite3`, located in the directory defined in the `miden-client.toml` file. + +To clear all state, delete this file. It recreates on any command execution. + +## Congratulations! + +You have successfully configured and used the Miden client to interact with a Miden rollup and faucet. + +You have performed basic Miden rollup operations like sending transactions, generating and consuming notes. + +For more information on the Miden client, refer to the [Miden client documentation](https://docs.polygon.technology/miden/miden-client/). + diff --git a/docs/introduction/get-started/prerequisites.md b/docs/introduction/get-started/prerequisites.md new file mode 100644 index 000000000..39f3b1612 --- /dev/null +++ b/docs/introduction/get-started/prerequisites.md @@ -0,0 +1,24 @@ +This section shows you how to get started with Miden by generating a new Miden account, requesting funds from a public faucet, and interacting with the Miden rollup using the Miden client. + +By the end of this tutorial, you will have: + +- Configured the Miden client. +- Connected to a Miden node. +- Created an account and requested funds from the faucet. +- Transferred assets between accounts by generating and consuming notes. + +## Prerequisites + +### Rust + +Download from [the Rust website](https://www.rust-lang.org/learn/get-started). + +### Miden node IP address + +You will need access to a Miden node. The node processes transactions and creates blocks for the Miden rollup. + +Get the IP address of the running Miden node by contacting one of the Miden engineers. + +### Miden client + +Install the [Miden client](https://docs.polygon.technology/miden/miden-client/install-and-run/). \ No newline at end of file diff --git a/docs/introduction/getting-started.md b/docs/introduction/getting-started.md deleted file mode 100644 index 9cb7bc45e..000000000 --- a/docs/introduction/getting-started.md +++ /dev/null @@ -1,197 +0,0 @@ -# Getting started - -This tutorial will guide you through the process generating a new Miden account, requesting funds from a public faucet and interacting with the Miden rollup using the Miden client. - -The Miden node processes transactions and creates blocks for the Miden rollup. The Miden client provides a way to execute and prove transactions, facilitating the interaction with the Miden rollup. By the end of this tutorial, you will be able to configure the Miden client, connect to a Miden node, and perform basic operations like sending transactions, generating and consuming notes. - -### Prerequisites - -Before starting, ensure you have the following: - -- **Rust Installed:** You must have the Rust programming language installed on your machine. If you haven't installed Rust, you can download it from [the Rust website](https://www.rust-lang.org/learn/get-started). - -- **Node IP Address:** Obtain the IP address of the running Miden node. This information can be acquired by contacting one of the Miden engineers. - -- **Miden client Installation:** You need to install the [Miden client](https://github.com/0xPolygonMiden/miden-client) and configure it to point to the remote node. - -## Part 1: Creating a Miden account & using the faucet - -In this first part of the tutorial we will teach you how to create a new Miden account locally and how to receive funds from the public Miden faucet website. - -### Configuring the Miden client - -1. **Download the Miden client:** First, download the Miden client from its repository. Use the following command: - - ```shell - git clone https://github.com/0xPolygonMiden/miden-client - ``` - -2. **Navigate & Configure the client:** Navigate to the client directory and modify the configuration file to point to the remote Miden node. You can find the configuration file at `./miden-client.toml`. In the `[RPC]` section replace the `endpoint = { host: }` field with the address provided by the Miden team. - - ```shell - cd miden-client - ``` - - Configuration file example: - - ```toml - [rpc] - endpoint = { protocol = "http", host = "", port = 57291 } - - [store] - database_filepath = "store.sqlite3" - ``` - -3. **Build & install the Client:** install the client using cargo: - - ```shell - cargo install --features testing,concurrent --path . - ``` - - you should now be able to use the following command: - - ```shell - miden-client --help - ``` -### Creating a new Miden account - -1. **Creating a new account:** To be able to interact with the Miden rollup you will need to generate an account. For this first part of the example we will generate one `basic-immutable` account using the following command: - - ```shell - miden-client account new basic-immutable - ``` - - Please refer to the documentation of the CLI - -2. **Listing accounts:** To view the newly created account we can run the following command: - - ```shell - miden-client account -l - ``` - - We should now see 1 available account listed: - - `basic-immutable` - -### Requesting tokens from the public faucet - -1. **Navigating to the faucet website:** To request funds from the faucet navigate to the following website: [Miden faucet website](https://ethdenver.polygonmiden.io/) - -2. **Requesting funds from the faucet:** Now that you have created your Miden account and navigated to the faucet website you should now be able to copy your `AccountId` that has been printed by the `miden-client account -l` command that you used in the previous steps. Paste this id into the field present on the faucet website and click `Send me tokens!`. After a few seconds your browser should download or prompt you to download a file called `note.mno` (mno = Miden Note), save this file on your computer, it will be needed for the next steps and contains the funds sent by the faucet destined to your address. - -### Importing the note into the Miden client - -1. **Importing & visualising notes:** From your terminal we will use the Miden client to import and visualise the note that you have received using the following commands: - - ```shell - miden-client input-notes -i - ``` - - Now that the note has been successfully imported you should be able to visualise it's information using the following command: - - ```shell - miden-client input-notes -l - ``` - - As you can see the listed note is lacking a `commit-height` this is due to the fact that you have received a note off-chain but have not synced your view of the rollup to check that the note is valid and exists at the rollup level. This is essential to prevent double-spend and make sure that you consume notes that have not yet been nullified. Hence before consuming the note we will need to update or view of the rollup and sync. - -2. **Syncing the client:** The client needs to periodically query the node to receive updates about entities that might be important in order to run transactions. The way to do so is by running the `sync` command: - - ```shell - miden-client sync - ``` - - -### Consuming the note & receiving the funds - -1. **Consuming the note:** Now that we have synced the client the input-note that we have imported from the faucet should have a `commit-height` confirming it's existence at the rollup level: - - ```shell - miden-client input-notes -l - ``` - We can now consume the note and add the funds contained inside it's vault to our account using the following commands: - - ```shell - miden-client tx new consume-notes - ``` - - You should be able to find your account and note id by listing both `accounts` and `input-notes`: - - ```shell - miden-client account -l - miden-client input-notes -l - ``` - -2. **Visualising account vault:** After successfully running the previous commands your account should now contained the tokens sent from the faucet. You can visualise your accounts vault by running the following command: - - ```shell - miden-client account show -v - ``` - You should now see your accounts vault containing the funds sent by the faucet. - -#### Congratulations! You finished the first part of the tutorial, continue to learn more about Miden and understand how to send Peer-to-Peer private off-chain transactions! - -## Part 2: Peer-to-Peer private off-chain transactions - -In this second part of the tutorial we will teach you how to make off-chain transactions and send funds to another account using the Miden client. - -> **Note**: -> We consider that you have done the first part of the turorial and that the state of your local client has not been reset. - - -### Setting-up the Miden client - -1. **Creating a second account:** To be able to send funds from one account to another we will need to generate one more account. For this example we will be generating 1 additional account: we generated `basic-immutable` account A in the first part of the tutorial. Here we will be creating `basic-immutable` account B using the following command: - - ```shell - miden-client account new basic-immutable - ``` - - Please refer to the documentation of the CLI - -2. **Listing accounts:** To view the newly created accounts we can run the following command: - - ```shell - miden-client account -l - ``` - - We should now see 2 available accounts listed: - - `basic-immutable` account A (created during the first part of this tutorial) - - `basic-immutable` account B - -### Transferring assets between accounts - -Now that we have two accounts we are ready to transfer some of the tokens we received from the faucet into account A. We will now transfer some to our second regular account B. To do so, you can run: - -```shell -miden-client tx new p2id -``` - -> **Note** -> The faucet account id can be found on the faucet website under the title "Miden faucet". - -This will generate a Pay-to-ID (`P2ID`) note containing `` assets, transferred from one regular account to the other. If we sync, we can now make use of the note and consume it for the receiving account: - -```shell -miden-client sync # Make sure we have an updated view of the state -miden-client input-notes list # Now use the second note id -miden-client tx new consume-notes # Consume the note -``` - -That's it! You should now be able to see both accounts containing assets coming from the faucet and then transferred from `Account A` to `Account B`. - -```shell -miden-client account show -v # Show account B's vault assets (50 fungible tokens) -miden-client account show -v # Show account A's vault assets (950 fungible tokens) -``` - -### Clearing the state - -All state is maintained in `store.sqlite3`, located in the directory defined in the `miden-client.toml` file. In case it needs to be cleared, the file can be deleted; it will later be created again when any command is executed. - -## Conclusion - -Congratulations! You have successfully configured and used the Miden client to interact with a Miden rollup and faucet. With these steps, you can perform basic Miden rollup operations like sending transactions, generating and consuming notes. - -For more information on the Miden client, refer to the [Readme of the Miden Client](https://github.com/0xPolygonMiden/miden-client) - -For more information on the Miden rollup, refer to the [Miden documentation](https://0xpolygonmiden.github.io/miden-base/introduction.html). diff --git a/docs/introduction/welcome.md b/docs/introduction/welcome.md index 594c23476..271327792 100644 --- a/docs/introduction/welcome.md +++ b/docs/introduction/welcome.md @@ -1,54 +1,108 @@ # Polygon Miden -Miden is a zero-knowledge rollup for high-throughput and private applications. Miden allows users to prove state changes of local data where the network only tracks a commitment of it. This leads to privacy and high-throughput. We think, Privacy Scales Better. Users can also let the Operator prove public state changes as in other known rollups. +Polygon Miden is a zero-knowledge rollup for private, high-throughput applications. -Polygon Miden is a modular execution layer that extends Ethereum's capabilities using powerful features such as parallel transaction execution and client-side proving. With Miden, developers can create novel, high-throughput, privacy preserving dApps for DeFi, RWA and Autonomous Worlds using their favorite languages such as Rust and TypeScript. +It is a modular execution layer that extends Ethereum's capabilities using powerful features such as parallel transaction execution and client-side proving. -If you want to join the technical discussion, please check out +Miden allows users to prove state changes locally while the network only tracks a commitment, leading to privacy and high-throughput. Users can also let the operator prove public state changes like other rollups. -* the [Discord](https://discord.gg/0xpolygondevs) -* the [Repo](https://github.com/0xPolygonMiden) -* the [Roadmap](roadmap.md) +With Miden, developers can create novel, high-throughput, privacy-preserving dApps for DeFi, [RWA](https://en.wikipedia.org/wiki/Risk-weighted_asset), and [Autonomous Worlds](https://autonomousworlds.com/) with languages such as Rust and TypeScript. -> *This documentation is still Work In Progress. Some topics have been discussed in greater depth, while others require additional clarification. Sections of this documentation might later be reorganized in order to achieve a better flow.* +If you want to join the technical discussion, please check out the following: + +* [Discord](https://discord.gg/0xpolygondevs) +* [Miden repo](https://github.com/0xPolygonMiden) +* [Roadmap](roadmap.md) + +!!! info + - These docs are still work-in-progress. + - Some topics have been discussed in greater depth, while others require additional clarification. ## Status and features -Polygon Miden is currently on release v0.1. This is an early version of the protocol and its components. We expect to keep making even breaking changes to all components. +Polygon Miden is currently on release v0.1. This is an early version of the protocol and its components. -At this point, adventurous Pioneers can execute first transactions and send assets to each other. Polygon Miden doesn't offer all the features one would expect from a zkRollup, yet. During 2024, we expect to offer gradually more features. Eventually, developers should be able to code any application they want on Polygon Miden. +!!! important + We expect breaking changes on all components. + +At the time of writing, Polygon Miden doesn't offer all the features you may expect from a zkRollup. During 2024, we expect to gradually implement more features. ### Feature highlights -* **Private accounts**. The Miden Operator only tracks a commitment to any account data in the public database. Users can only execute smart contracts of which they know the interface. -* **Private notes**. Like private accounts, the Miden Operator only tracks a commitment to any notes in the public database. Users need to communicate note details to each other off-chain (via any side channel) in order to consume private notes in transactions. -* **Local transaction execution**. The Miden Client allows for local transaction execution and proving. The Miden Operator verifies the proof and if valid, the state DBs are updated with the new data. -* **Simple smart contracts**. Currently, there are three different smart contracts available. A basic wallet smart contracts to send and receive assets, and fungible and non-fungible faucets to mint and burn assets. All accounts are written in MASM. -* **P2ID, P2IDR and SWAP note scripts**. Currently, there are three different note scripts available. Two different versions of pay-to-id scripts of which P2IDR is reclaimable, and a swap script that allows for simple token swaps. -* **Simple block building**. The Miden Operator running the Miden Node is able to build blocks containing transactions. There is no recursive verification of transactions enabled yet. -* **Maintaining state**. The Miden Node stores all necessary information already in its State DBs and provides this infos via its RPC endpoint. +#### Private accounts + +The Miden operator only tracks a commitment to account data in the public database. Users can only execute smart contracts when they know the interface. + +#### Private notes + +Like private accounts, the Miden operator only tracks a commitment to notes in the public database. Users need to communicate note details to each other off-chain (via a side channel) in order to consume private notes in transactions. + +#### Local transaction execution + +The Miden client allows for local transaction execution and proving. The Miden operator verifies the proof and, if valid, updates the state DBs with the new data. + +#### Simple smart contracts + +Currently, there are three different smart contracts available. A basic wallet smart contract that sends and receives assets, and fungible and non-fungible faucets to mint and burn assets. + +All accounts are written in [MASM](https://0xpolygonmiden.github.io/miden-vm/user_docs/assembly/main.html). + +#### P2ID, P2IDR, and SWAP note scripts + +Currently, there are three different note scripts available. Two different versions of pay-to-id scripts of which P2IDR is reclaimable, and a swap script that allows for simple token swaps. + +#### Simple block building + +The Miden operator running the Miden node builds the blocks containing transactions. + +#### Maintaining state + +The Miden node stores all necessary information in its state DBs and provides this information via its RPC endpoints. ### Planned features -* **Public accounts**. Polygon Miden will support public smart contracts as know on Ethereum. Code and state of those accounts will be visible to the network and anyone can execute transactions against them. -* **Public notes**. As with public accounts, also public notes will be supported. That means, note data will be publicly stored by the Miden Operator. Note consumption will not be private. -* **Customized smart contracts**. Accounts can expose any interface in the future. This is the Miden version of a smart contract. Account code can be arbitrary complex due to the underlying Turing-complete Miden VM. -* **Customized note scripts**. Users will be able to write their own note scripts using the Miden Client. Note scripts are executed during note consumption and they can be arbitrary complex due to the underlying Turing-complete Miden VM. -* **Network transactions**. Transaction execution and proving can be outsourced to the network and to the Miden Operator. Those transactions will be necessary when it comes to public shared state, and they can be useful if the user's device is not powerful enough to prove transactions efficiently. -* **Rust compiler**. In order to write account code, note or transaction scripts, in Rust, there will be a Rust -> Miden Assembly compiler. -* **Block and epoch proofs**. The Miden Node will recursively verify transactions and in doing so build batches of transactions, blocks and epochs. +!!! warning + The following features are at a planning stage only. + +#### Public accounts + +Polygon Miden will support public smart contracts like Ethereum. Code and state of those accounts will be visible to the network and anyone can execute transactions against them. + +#### Public notes + +As with public accounts, public notes will also be supported. That means, the Miden operator will publicly store note data. Note consumption will not be private. + +#### Customized smart contracts + +Accounts can expose any interface in the future. This is the Miden version of a smart contract. Account code can be arbitrarily complex due to the underlying Turing-complete [Miden VM](https://0xpolygonmiden.github.io/miden-vm/intro/main.html). + +#### Customized note scripts + +Users will be able to write their own note scripts using the Miden client. Note scripts are executed during note consumption and they can be arbitrarilyy complex due to the underlying Turing-complete Miden VM. + +#### Network transactions + +Transaction execution and proving can be outsourced to the network and to the Miden operator. Those transactions will be necessary when it comes to public shared state, and they can be useful if the user's device is not powerful enough to prove transactions efficiently. + +#### Rust compiler + +In order to write account code, note or transaction scripts, in Rust, there will be a Rust -> Miden Assembly compiler. + +#### Block and epoch proofs + +The Miden node will recursively verify transactions and in doing so build batches of transactions, blocks, and epochs. ## Benefits of Polygon Miden -* Ethereum security -* Developers can build applications infeasible on other systems, e.g. - * **onchain order book exchange** due to parallel tx execution and updatable transactions - * **complex, incomplete information games** due to client-side proving and cheap complex computations - * **safe wallets** due to assets being stored in the accounts and account state can be hidden -* Better privacy properties than on Ethereum - first web2 privacy, later even stronger privacy guarantees -* Transactions can be recalled and updated -* Lower fees due to client-side proving -* dApps on Miden are safe to use due to account abstraction and compile-time safe Rust smart contracts +* Ethereum security. +* Developers can build applications that are infeasible on other systems. For example: + * **onchain order book exchange** due to parallel transaction execution and updatable transactions. + * **complex, incomplete information games** due to client-side proving and cheap complex computations. + * **safe wallets** due to hidden account state. +* Better privacy properties than on Ethereum - first web2 privacy, later even stronger privacy guarantees. +* Transactions can be recalled and updated. +* Lower fees due to client-side proving. +* dApps on Miden are safe to use due to account abstraction and compile-time safe Rust smart contracts. ## License diff --git a/docs/network/network.md b/docs/network/network.md index 6b3cb46aa..d0cba5d1a 100644 --- a/docs/network/network.md +++ b/docs/network/network.md @@ -1,27 +1,55 @@ -Polygon Miden is a bi-directional token bridge and state machine. Miden Nodes act as operators that keep the state and compress state transitions recursively into STARK-proofs. The token bridge on Ethereum verifies these proofs. Users can run Miden clients to send RPC requests to the Miden Nodes to update the state. +!!! tip "Recap" + Polygon Miden network architecture contains a bi-directional token bridge and state machine. -The major components of Polygon Miden are: + Miden nodes act as operators that maintain state and compress state transitions recursively into STARK-proofs. The token bridge on Ethereum verifies these proofs. -- Miden Clients - represent Miden users -- Miden Nodes - manage the Miden rollup and compress proofs -- Verifier Contract - keeps and verifies state on Ethereum -- Bridge Contract - entry and exit point for users + Users can run Miden clients to send RPC requests to the Miden nodes to update the state. + The major components of the Polygon Miden network are: -## Network Slide -![Miden Architecture Overview](../img/network/architecture-overview.svg) + - Miden clients which represent Miden users. + - Miden nodes which manage the Miden rollup and compress proofs. + - A verifier contract which maintains and verifies state on Ethereum. + - A bridge contract as an entry and exit point for users. -## Miden Clients -Users will run Miden Clients. They are designed to provide an interface for wallets representing accounts on Miden. Miden Clients can execute and prove transactions in the Tx Prover. They can handle arbitrary signature schemes - whereas the default is Falcon. The wallet interface serves a user interface, a wallet database to be able to store account data locally, and the required smart contract code that represents the account on Miden. +## Overview of the Miden network -## Miden Nodes -Operators will run Miden Nodes. Operators ensure integrity of the Account, Note and Nullifier State - which represent the state of Polygon Miden. Operators can execute and proof transactions against single accounts and they can verify proofs of locally executed transactions. Furthermore, the operator compresses the proofs in several steps up to a single proofs that gets published and verified on the Verifier contract. Operators also watch events emitted by the Bridge Contract to detect deposits and withdrawals. +![Miden architecture overview](../img/network/architecture-overview.svg) -To manage all of this, Miden Nodes have different modules. The Node orchestrates a Tx Prover, a Tx Aggregator and a Block Producer. The Tx Prover executes and proves transactions, like in the Miden Client. The Tx Aggregator can batch multiple proofs together to reduce the final state proof size using recursive proving. The Block Producer exposes the RPC interface to the user. The Block Producer collects transactions in the Tx Pool and stores the state of Polygon Miden in its three databases (Accounts, Notes, Nullifiers). +## Miden clients + +Users run Miden clients and they provide an interface for wallets representing accounts on Miden. + +Miden clients can execute and prove transactions with the tx prover. They can handle arbitrary signature schemes. The default is [Falcon](https://falcon-sign.info/). There is a wallet user interface, a database that stores account data locally, and the required smart contract code that represents the account on Miden. + +## Miden nodes + +Operators run Miden nodes. + +Operators ensure integrity of account, note, and nullifier states - all of which represent the state of Polygon Miden. Operators can execute and prove transactions against single accounts and they can also verify proofs of locally executed transactions. + +Furthermore, the operator compresses the proofs in several steps up to a single proof that gets published and verified on the verifier contract. Operators also watch events emitted by the bridge contract to detect deposits and withdrawals. + +### Node modules + +To manage all of this, Miden nodes have separate modules. + +- Tx prover: Executes and proves transactions, like the Miden client. +- Tx aggregator: Batches multiple proofs together to reduce the final state proof size using recursive proving. +- Block producer: exposes the RPC interface to the user and collects transactions in the tx pool and stores the state of Polygon Miden in its three databases (accounts, notes, and nullifiers). + +## Verifier contract -## Verifier Contract This contract on Ethereum verifies proofs sent by the operator running a Miden Node. The proof is verified against the current state root. If accepted the state root changes. -## Bridge Contract -This contract serves the Miden users on Ethereum as bridge. Users can deposit their tokens and get an equivalent amount minted and sent to the specified address on Polygon Miden. +!!! note + - Polygon Miden will integrate into the AggLayer. + - The specific design is not yet finalized. + +## Bridge contract + +This contract serves as a bridge for Miden users on Ethereum. Users can deposit their tokens and get an equivalent amount minted and sent to the specified address on Polygon Miden. +!!! note + - Polygon Miden will integrate into the AggLayer and the Unified Bridge. + - The specific design is not yet finalized. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index adfeeed63..4edc0c2f8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,7 +23,10 @@ theme: nav: - Welcome: introduction/welcome.md - - Getting started: introduction/getting-started.md + - Get started: + - Prerequisite steps: introduction/get-started/prerequisites.md + - Create account and use the faucet: introduction/get-started/create-account-use-faucet.md + - Private peer-to-peer off-chain txs: introduction/get-started/p2p-private-offchain-txs.md - Roadmap: introduction/roadmap.md - Architecture: - Architecture overview: architecture/overview.md