Skip to content

Repository files navigation

aztec-wallet

Overview

  • 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 useBabyJubJub and useSchnorr. 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.

The curves that are used to create the account abstractions are:

BabyJubJub

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.

Bls12381

(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

The implementation of the bls curve library is compatible to be computed over the bn254 field

schnorr

Schnorr – Known for its efficient and secure signature scheme, providing enhanced privacy features.

Successful account creation and deployment with hardcoded public key.

src
├── contracts/
│   ├── account_schnorr/
│   │   ├── src/
│   │   │    └── main.nr
│   │   └── Nargo.toml
│   ├── hooks/
│   │   └── useSchnorr.tsx

ecdsa

ECDSA (Ethereum's Curve) – The elliptic curve used by Ethereum, ensuring compatibility with Ethereum-based applications.

Installation

Prerequisites

You need two global dependencies in your machine:

  1. Node.js >= v18 (recommend installing with nvm)

  2. Docker (visit this page of the Docker docs on how to install it)

  3. To install aztec's tooling, including aztec's sandbox, aztec-cli, aztec-nargo and aztec-up, run:

    bash -i <(curl -s install.aztec.network)
    
  4. Once these have been installed, to start the sandbox, run:

    aztec start --sandbox
    

Steps

  1. Go to the src/contracts to compile and generate contracts ABI artifacts. - go to the babyjubjub_account, ecdsa_k_account and account_schnorr directories respectively and execute

        aztec-nargo compile --silence-warnings
    

    dependencies this will compile each contract.

  • to generate the ABI artifacts, run (again for each contract)

      aztec codegen target/ -o ../../../artifacts/
    
  1. Return back to the rooot directory and execute yarn install to install all the needed dependencies.

  2. Now execute this command (in the root directory) to deploy the token contract which will generate accounts.json file that can be later on used by the PXE.

    node deploy.js
    
  3. Finally, to run the programs in the localhost run: yarn dev

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages