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.
git clone [email protected]:porco-rosso-j/aztec-snap.git
cd .aztec
aztec-sandbox
install dependencies:
yarn
start snap server:
cd packages/snap
yarn start
start frontend:
cd packages/site
yarn dev
The current implementation is an app for managing AztecSnap Wallet. But you can build any frontend dapp modifying this directory.
This directory contains snap's backend source code.
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();