Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Combine 'How to run' and 'Quickstart' sections #159

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ SCBridge-Wallet
An L2 state channel bridge contract which is also an ERC-4337 compliant smart contract wallet.
</h3>

# How to Run
# Quickstart

- In a new terminal start the first chain by running `yarn chain:a`
- In a new terminal start the second chain by running `yarn chain:b`
- In a new terminal deploy the contracts and start the UI by running: `yarn deploy-and-start`
Run each of these commands from the repo root directory:

### Ingredients
```
yarn
yarn chain:a
yarn chain:b
yarn deploy-and-start
```

This repo contains Solidity source code for a state channel bridge smart contract. It uniquely offers the ability to use deposited funds not only to send offchain payments to other channel network participants with zero fees and instant finality, but also to send arbitrary transactions on the underlying L1 blockchain without having to withdraw them first in a separate transaction.
These commands do the following:

This functionality is achieved by inviting a channel network peer to be a co-signatory Intermediary on your smart contract wallet. L1 transactions are first send to that Intermediary, who countersigns them and submits them to the mempool. The Intermediary therefore plays a role similar to an ERC-4337 "bundler" (only simpler). The Intermediary has the right to veto any L1 transaction, although they can be ejected at any time (and then either replaced with another Intermediary, or not). This allows them to ensure they retain any off-chain payments promised to them by the wallet owner. If they are ejected, they get to take that money with them.
1. starts two different `hardhat` blockchain networks (chain a and chain b)
2. deploys the necessary smart contracts:

By having that Intermediary perform the same role in several users' smart contract wallets, the off-chain payments can be routed over arbitrary hops through a payment network (a la Bitcoin Lightning).
- `EntryPoint` on both chains
- `SCBridge-Wallet` for Alice on chain a
- `SCBridge-Wallet` for Bob on chain b

This repo also contains Typescript source code for off-chain clients that can be run by a user and by a Intermediary, to enable to orchestrate the functionality described above.
3. serves the UI on `http://localhost:5173/`

### Quickstart
Open three browser tabs (all accessing `http://localhost:5173/`) and select a different user (Alice, Irene, Bob) for each tab to allow the cross-user messaging to work.

Run the following sequence of commands to spin up a local demo environment.
### Ingredients

```
yarn
yarn chain:local
yarn deploy:local && yarn start
```
This repo contains Solidity source code for a state channel bridge smart contract. It uniquely offers the ability to use deposited funds not only to send offchain payments to other channel network participants with zero fees and instant finality, but also to send arbitrary transactions on the underlying L1 blockchain without having to withdraw them first in a separate transaction.

These commands do the following:
This functionality is achieved by inviting a channel network peer to be a co-signatory Intermediary on your smart contract wallet. L1 transactions are first send to that Intermediary, who countersigns them and submits them to the mempool. The Intermediary therefore plays a role similar to an ERC-4337 "bundler" (only simpler). The Intermediary has the right to veto any L1 transaction, although they can be ejected at any time (and then either replaced with another Intermediary, or not). This allows them to ensure they retain any off-chain payments promised to them by the wallet owner. If they are ejected, they get to take that money with them.

1. starts a local `hardhat` blockchain network
2. deploys the necessary smart contracts: `EntryPoint`, `SCBridge-Wallet` for Alice, `SCBridge-Wallet` for Bob
3. serves the UI on `http://localhost:5173/`
By having that Intermediary perform the same role in several users' smart contract wallets, the off-chain payments can be routed over arbitrary hops through a payment network (a la Bitcoin Lightning).

Open three browser tabs (all accessing `http://localhost:5173/`) and select a different user (Alice, Irene, Bob) for each tab to allow the cross-user messaging to work.
This repo also contains Typescript source code for off-chain clients that can be run by a user and by a Intermediary, to enable to orchestrate the functionality described above.

### Sequence Diagram

Expand Down