Skip to content

Add Counter Contract project to examples #482

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

Open
greenhat opened this issue Apr 21, 2025 · 2 comments · May be fixed by #492
Open

Add Counter Contract project to examples #482

greenhat opened this issue Apr 21, 2025 · 2 comments · May be fixed by #492

Comments

@greenhat
Copy link
Contributor

greenhat commented Apr 21, 2025

After #436 is merged.

Motivation

We need a new example project in the examples/ directory demonstrating how to write and deploy a simple counter contract using the Miden SDK. This will complement the existing storage-example project by showcasing the account API in action and providing a reference implementation for developers.

Implementation

  1. Create a new folder: examples/counter-contract
  2. Scaffold a Rust-based client project in that folder, following the pattern in examples/storage-example:
    • Include Cargo.toml, src/lib.rs, and WIT files.
  3. Write the contract code inspired by the tutorial's MASM code at miden-tutorials.
  4. Add documentation (README.md) in the counter-contract folder explaining:
    • How to build the contract.
    • How to run the example client (link to the miden-tutorials.
  5. Add a counter_contract test in tests/integration/src/rust_masm_tests/examples.rs that compiles it and checks the code and AccountComponentMetadata from the Miden package.
@greenhat
Copy link
Contributor Author

Following the discussion with @partylikeits1983

@partylikeits1983
Copy link
Contributor

@greenhat Using your storage example as a reference, this is the counter rust contract that I wrote: https://github.com/partylikeits1983/compiler-hackathon-counter/tree/main/examples/counter-example

The only part that is missing is the call to increment the nonce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants