Skip to content

porco-rosso-j/aztec-snap

Repository files navigation

Metamask Snap on Aztec Sandbox

Aztec Snap is the first MetaMask Snap on Aztec that enables private function calls to any Aztec contract.

AztecSnap deterministically derives private keys from the existing seed phrase managed by Metamask via Snap's api call snap_getBip44Entropy to offer great security and UX for ethereum users.

More specifically, it currently uses the derived private key as a signing key for ECDSAAccountContract, while the encryption key is the one reduced from the same private key to a new valid grumpkin scalar value.

Develop with AztecSnap

clone this project

git clone git@github.com:porco-rosso-j/aztec-snap.git

run sandbox and local ethereum fork

cd .aztec
aztec-sandbox

install packages and start

install dependencies:

yarn

start snap server:

cd packages/snap
yarn start

start frontend:

cd packages/site
yarn dev

Packages

snap-dapp (./packages/site)

The current implementation is an app for managing AztecSnap Wallet. But you can build any frontend dapp modifying this directory.

aztec-snap (./packages/snap)

This directory contains snap's backend source code.

aztec-snap-lib (,/packages/lib)

aztec-snap-lib is a library that exports SnapWallet instance.

SnapWallet can be thought of as ethers's Signer intance that can be instantiated and used like following.

example:

import { AztecSnap, SnapWallet } from '@abstract-crypto/aztec-snap-lib';

const aztecSnap = new AztecSnap(pxe);
const wallet: SnapWallet = aztecSnap.connect();

const token = await TokenContract.at(
  AztecAddress.fromString(TOKEN_ADDRESS),
  wallet,
);

const sentTx: SentTx = await token.methods
  .transfer_public(
    AztecAddress.fromString(fromAddress),
    AztecAddress.fromString(toAddress),
    Number(amount),
    0,
  )
  .send();

await sentTx.wait();

Reference

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published