Skip to content

feat(aztec)!: add counter template for aztec init#22751

Open
nchamo wants to merge 1 commit intomerge-train/fairiesfrom
feat/init-counter-template
Open

feat(aztec)!: add counter template for aztec init#22751
nchamo wants to merge 1 commit intomerge-train/fairiesfrom
feat/init-counter-template

Conversation

@nchamo
Copy link
Copy Markdown
Contributor

@nchamo nchamo commented Apr 23, 2026

Why we are doing this

The default project scaffolded by aztec init was too minimal -- it created a blank contract with no callable functions, making it hard for new developers to understand how Aztec contracts work.

How it worked before

  • aztec init created a workspace with a blank contract (empty impl block) and a basic test
  • aztec new <name> created the same blank contract, either as a new project or adding to an existing workspace

What changes

  • aztec new stays the same -- it scaffolds a blank contract, either as a new standalone project or as a new crate added to an existing workspace
  • aztec init now scaffolds a Counter example with:
    • A private counter contract using Owned<BalanceSet> for encrypted state
    • Annotated functions (constructor, increment, get_counter) with short docs explaining privacy model and execution context
    • A test suite covering constructor initialization and increment

Technical details

We used to build the blank project directly from the bash script. Now we have templates we can simply copy, instead of containing the entire code inside the .sh file

What doesn't change

The existing Counter tutorial docs remain valid since they use aztec new, which still scaffolds the blank template.

Feedback wanted

Please let me know if you have any suggestions on the template content, comments or anything else.

Fixes F-581

@nchamo nchamo requested a review from charlielye as a code owner April 23, 2026 18:24
@nchamo nchamo self-assigned this Apr 23, 2026
@nchamo nchamo changed the title feat(aztec): add counter template for aztec init feat(aztec)!: add counter template for aztec init Apr 23, 2026
#[storage]
struct Storage<Context> {
// Each owner has their own counter, stored as private encrypted notes.
// Owned: only the owner can interact with their own counter.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be worth clarifying that "ownership" is achieved via readability (encryption) rather than access control (e.g. "Owned dictates who will receive the encrypted notes")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, definitely worth mentioning

@nchamo nchamo requested review from dbanks12 and vezenovm April 23, 2026 20:32
Copy link
Copy Markdown
Contributor

@dbanks12 dbanks12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once @critesjosh and others are happy!

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 this pull request may close these issues.

3 participants