0xPolygonMiden / examples

Examples of using Polygon Miden
MIT License
16 stars 14 forks source link

Miden Assembly Playground

Playground for example programs for the Miden VM in Miden assembly.

Use the playground!

The goal of this playground is for developers to see how easy it is to write and execute code in Miden assembly. The examples come from the community and the team. If you come up with an example of your own, we are happy to include it in the list below. You can simply open a PR with your example adding the .masm and .inputs files.

Examples are written in Miden assembly, see Miden assembly documentation. External inputs can be provided to the examples and the Miden VM in two ways as public inputs and via the advice provider, see here. Currently, in the playground you can use operand_stack as public input and the advice_stack as secret input.

In addition to running existing examples you can also write your own program and execute it. The examples can then serve as inspiration.


Available examples

There are several examples in our repo and we hope we get more in the future. The examples range from simple to complex and aim to show how Miden assembly can be used.

Simple examples - to see how the code works

Math examples - see more complex numerical calculations

Complex examples - larger complex nested operations


Running the playground locally

You can also run the playground locally on your machine.

Starting site

If you want to run it locally, then make sure you have the wasm-pack installed.

To run the playground locally in development mode, navigate to the project directory playground and run:

npm run build:miden && npm install && npm run start

Open http://localhost:3000 to view it in the browser.

Test rust code:

cd miden-wasm && wasm-pack test --node

Acknowledgement

We use a fork of https://github.com/timgestson/miden-assembly-playground