Giter Site home page Giter Site logo

aztec-snap's Introduction

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 [email protected]: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

aztec-snap's People

Stargazers

 avatar  avatar

Watchers

 avatar

aztec-snap's Issues

.simulate rpc call

viewing keys are only on snap side, which means that apps connected with the wallet can't really let user show their own private state data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.