-
Contracts: The Contracts directory contains Noir smart contracts for various account implementations, including BabyJubJub, Bls12381, Schnorr, and ECDSA. These contracts define the logic for account creation, key management, and transaction verification on the Aztec network.
-
Hooks: This directory includes React hooks such as
useBabyJubJubanduseSchnorr. These hooks integrate account functionality into the UI, making it easier to manage accounts and perform operations using different cryptographic curves. -
Pages: The Pages directory contains React components for account creation, management, and transaction handling. These components form the user interface of the wallet application.
-
Accounts: This directory contains TypeScript implementations for account management, with a focus on BabyJubJub and potentially other curves. It includes files for handling account contracts, signatures, and interfaces specific to different cryptographic curves.
A lightweight elliptic curve optimized for zk-SNARKs, offering privacy and scalability. Structure of programs and smart contracts related to the BabyJubJub elliptic curve
src
├── contracts/
│ ├── babyjubjub_public_key_note/ // Creates, stores, de/serialize and computes nullifier of BabyJubJub public key
│ │ ├── src/
│ │ │ └── lib.nr
│ │ └── Nargo.toml
│ │
│ ├── babyjubjub_account/ // Main entrypoint of the BabyJubJub account, verifies its implementation.
│ │ ├── src/
│ │ │ └── main.nr
│ │ └── Nargo.toml
│ │
├── accounts/
│ ├── baby_jubjub/
│ │ ├── interface/
│ │ │ └── signature.ts
│ │ ├── account_contract.ts // Authenticates transactions with BabyJubJub signatures verified
│ │ │ // against a public key in an immutable encrypted note.
│ │ │
│ │ ├── index.ts // BabyJubjub signature construction and helper operations.
│ │ └── signature.ts // BabyJubJub signature used for transactions.
│ │
│ └── babyjubjub.ts // Creates an Account Manager using a BabyJubJub key for authentication and retrieves a wallet with BabyJubJub signatures.
│
├── hooks/
│ └── useBabyJubJub.tsx
⚠️ The noir smart contracts implementation is practically ready but needs barretenberg cpp backend. ⚠️
Important
As shown in the structure above, there is an AztecJS implementation of the BabyJubJub signature verification and creation, the account creation with the help of BarretenbergSync from the bb.js library. That's why the deployment of the account created with the BabyJubJub curve isn't yet available because of the aforementioned reasons. But since it's using 64 bytes for signature and 32 bytes for the public key's coordinates which are the same as Schnorr's signature and public key coordinates respecitvely, we are using Schnorr's barretenberg cpp implementation for the sake of PoC.
(Ongoing development) A curve for pairing-based cryptography, commonly used in multi-signature schemes. Structure of programs and smart contracts related to the Bls12381 elliptic curve:
src
├── contracts/
│ ├── public_key_bls12_381_note/
│ │ │ // Creates, stores, de/serialize and computes
│ │ │ // nullifier of bls12381 public key.
│ │ │ // Serialized to be compatible for the 254 bits field size.
│ │ ├── src/
│ │ │ └── lib.nr
│ │ └── Nargo.toml
│ │
│ ├── bls12_381_account/ // Main entrypoint of the Bls12381 account, verifies its implementation.
│ │ ├── src/
│ │ │ └── main.nr
│ │ └── Nargo.toml
Schnorr – Known for its efficient and secure signature scheme, providing enhanced privacy features.
src
├── contracts/
│ ├── account_schnorr/
│ │ ├── src/
│ │ │ └── main.nr
│ │ └── Nargo.toml
│ ├── hooks/
│ │ └── useSchnorr.tsx
ECDSA (Ethereum's Curve) – The elliptic curve used by Ethereum, ensuring compatibility with Ethereum-based applications.
You need two global dependencies in your machine:
-
Node.js >= v18 (recommend installing with nvm)
-
Docker (visit this page of the Docker docs on how to install it)
-
To install aztec's tooling, including aztec's sandbox, aztec-cli, aztec-nargo and aztec-up, run:
bash -i <(curl -s install.aztec.network) -
Once these have been installed, to start the sandbox, run:
aztec start --sandbox
-
Go to the
src/contractsto compile and generate contracts ABI artifacts. - go to thebabyjubjub_account,ecdsa_k_accountandaccount_schnorrdirectories respectively and executeaztec-nargo compile --silence-warningsdependencies this will compile each contract.
-
to generate the ABI artifacts, run (again for each contract)
aztec codegen target/ -o ../../../artifacts/
-
Return back to the rooot directory and execute
yarn installto install all the needed dependencies. -
Now execute this command (in the root directory) to deploy the token contract which will generate
accounts.jsonfile that can be later on used by the PXE.node deploy.js -
Finally, to run the programs in the localhost run:
yarn dev