8000 GitHub - 22388o/bls-wallet: Core components to use layer 2 smart contract wallets with the BLS signature scheme
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Core components to use layer 2 smart contract wallets with the BLS signature scheme

Notifications You must be signed in to change notification settings

22388o/bls-wallet

 
 

Repository files navigation

bls-wallet

An Ethereum Layer 2 smart contract wallet that uses BLS signatures and aggregated transactions to reduce gas costs.

You can watch a full end-to-end demo of the project here

Components

See each component's directory README for more details.

System Overview

Aggregator

Service which aggregates BLS wallet transactions.

Clients

TS/JS Client libraries for web apps and services.

Contracts

bls-wallet Solidity contracts.

Extension

Quill browser extension used to manage BLS Wallets and sign transactions.

Signer

TS/JS BLS Signing lib.

Dependencies

Required

Optional (Recomended)

Setup

Run the repo setup script

./setup.ts

Then choose to target either a local Hardhat node or the Arbitrum Testnet.

Local

Start a local Hardhat node for RPC use.

cd ./contracts
yarn hardhat node

You can use any two of the private keys displayed (PK0 & PK1) to update these values in ./aggregator/.env.

...
PRIVATE_KEY_AGG=PK0
PRIVATE_KEY_ADMIN=PK1
...

Set this value in ./contracts/.env (This mnemonic is special to hardhat and has funds).

...
DEPLOYER_MNEMONIC="test test test test test test test test test test test junk"
...

Deploy the PrecompileCostEstimator contract.

yarn hardhat run scripts/0_deploy_precompile_cost_estimator.ts --network gethDev

Copy the address that is output.

Update ./contracts/contracts/lib/hubble-contracts/contracts/libs/BLS.sol's COST_ESTIMATOR_ADDRESS to the value of that address;

...
address private constant COST_ESTIMATOR_ADDRESS = 0x57047C275bbCb44D85DFA50AD562bA968EEba95A;
...

Deploy all remaining bls-wallet contracts.

yarn hardhat run scripts/deploy_all.ts --network gethDev

Arbitrum Testnet (Rinkeby Arbitrum Testnet)

You will need two ETH addresses with Rinkeby ETH and their private keys (PK0 & PK1) for running the aggregator. It is NOT recommended that you use any primary wallets with ETH Mainnet assets.

You can get Rinkeby ETH at https://app.mycrypto.com/faucet, and transfer it into the Arbitrum testnet via https://bridge.arbitrum.io/. Make sure when doing so that your network is set to Rinkeby in MetaMask.

Update these values in ./aggregator/.env.

RPC_URL=https://rinkeby.arbitrum.io/rpc
...
NETWORK_CONFIG_PATH=../contracts/networks/arbitrum-testnet.json
PRIVATE_KEY_AGG=PK0
PRIVATE_KEY_ADMIN=PK1
...

And then update this value in ./extension/.env.

...

DEFAULT_CHAIN_ID=421611
...

Run

docker-compose up -d postgres # Or see local postgres instructions in ./aggregator/README.md#PostgreSQL
cd ./aggregator
./programs/aggregator.ts

In a seperate terminal/shell instance

cd ./extension
yarn run dev:chrome # or dev:firefox, dev:opera

Chrome

  1. Go to Chrome's extension page.
  2. Enable Developer mode.
  3. Either click Load unpacked extension... and select ./extension/extension/chrome or drag that folder into the page.

Firefox

  1. Go to Firefox's debugging page.
  2. Click Load Temporary Add-on....
  3. Select ./extension/extension/firefox/manifest.json.

Testing/using updates to ./clients

extension

cd ./contracts/clients
yarn build
yarn link
cd ../extension
yarn link bls-wallet-clients

aggregator

You will need to push up an @experimental version to 'bls-wallet-clients' on npm and update the version in ./aggregtor/src/deps.ts until a local linking solution for deno is found. See esm-dev/esm.sh#216 for details.

In ./contracts/clients with your changes:

yarn publish-experimental

Note the x.y.z-abc1234 version that was output.

Then in ./aggregtor/deps.ts, change all from references for that package.

...
} from "https://esm.sh/bls-wallet-clients@x.y.z-abc1234";
...

About

Core components to use layer 2 smart contract wallets with the BLS signature scheme

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 83.3%
  • Solidity 12.4%
  • SCSS 1.9%
  • JavaScript 1.7%
  • Shell 0.5%
  • HTML 0.2%
0