Jacob Caban-Tomski e222b53102 Improve ease and consistancy of monorepo setup
Move contract addresses from env vars to a common JSON network config.
Add io-ts to client to verify network config JSON.
Add setup.ts to bootstrap repo.
Add deploy script for use with deploying all contracts.
Add docker-compose.yml as alternative for postgres setup.
Add main README, update component READMEs.

Co-authored-by: Andrew Morris <voltrevo@gmail.com>
2021-11-29 13:06:43 -07:00

bls-wallet

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

Components

See each component's directory README for more details.

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
npx hardhat node

You can use any two of the private keys displayed for the aggregator (PK0 & PK1)

Update ./contracts/.env.

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

Deploy PrecompileCostEstimator.

npx 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.

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

Update ./aggregator/.env.

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

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 ./aggregator/.env

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

Update ./extension/.env

...

CHAIN_RPC_URL=https://rinkeby.arbitrum.io/rpc
...

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

For extension:

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

For aggregator, you will need to push up a release canidate (-rc) 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 https://github.com/alephjs/esm.sh/discussions/216 for details.

./aggregtor/deps.ts

...
} from "https://cdn.skypack.dev/bls-wallet-clients@x.y.z-rc.w?dts";
...
Description
No description provided
Readme MIT 11 MiB
Latest
2023-08-15 10:33:17 -04:00
Languages
TypeScript 97.7%
SCSS 1%
JavaScript 0.9%
Shell 0.3%