master
branch should work, but the other branches are outdated. Some of the details in this README may be out of date as well. This repo was originally created for a workshop at Devconnect 2023.
Additional notes in the hackmd here.
The master
branch is the third step, most complete branch of the workshop.
Check out 0-blank-signerless
for the first, simplest step and 1-counter-signerless
for the second step on this github repo.
- Make sure the sandbox is running.
- Install dependencies with
yarn
- Run with
yarn start
This is a bit more complex than the Blank contract because this contract has state, and allows users to update state.
State is encrypted notes that are owned by accounts and can be decrypted with the account's public key.
These interactions are still not coming from an account contract. msg_sender
is still the 0 address.
- Context
- Note
- Option
- Map
- Singleton
- Debugging
- ValueNote
- FieldNote
- EasyPrivateUint (note management)
secret
- For access control
- Provide the secret and execute functions
counters
- Stores a count, privately
Initialize a private, secret
value (in a FieldNote Singleton) that must be provided when calling increment
or update_secret
The last argument in the initialize
function indicates whether to broadcast a note. This is not implemented for FieldNotes, so must be manually added to the PXE in index.ts.
- Same logic as the base counter, but requires that the caller provide the
secret
value
Change the secret saved in storage (currently WIP). There is a bug in the PXE where old values are not nullified, so the Typescript isn't working as expected, but the code is there.
This function shows how to use logging for debugging in Aztec contracts.
Return the currently saved secret. This does not send a tx to the network, just decrypts and reads from local state, similar to a Solidity view
function.
Return the current count (sum of value notes in the set).
This function is required by the protocol to know how to handle private notes.
- Setup
- Deploy
- Add note
- Increment Counter
- Show failing cases (commented out)
- Read count
- Implement signature verification
- Discuss Authentication witnesses
- Review the existing Schnorr signer implementation