You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2023. It is now read-only.
@@ -14,7 +14,7 @@ Run each of these commands from the repo root directory:
14
14
yarn
15
15
yarn chain:a
16
16
yarn chain:b
17
-
yarn deploy-and-start
17
+
yarn deploy-and-start-local
18
18
```
19
19
20
20
These commands do the following:
@@ -40,28 +40,21 @@ By having that Intermediary perform the same role in several users' smart contra
40
40
41
41
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.
42
42
43
-
### Sequence Diagram
43
+
### Sequence Diagrams
44
44
45
-
Scenario: Alice wants to (a) pay Bob offchain and (b) execute a trade on Uniswap. Irene is an Intermediary actor.
45
+
Scenario: Alice wants to (a) pay Bob offchain and (b) pay Charley, who does not have a state channel bridge. Irene is an Intermediary actor.
46
46
47
-
In a typical state channel bridge architecture (green) she must deposit funds into the ID of a "ledger channel" in a Singleton adjudicator contract. Her counterparty in that ledger channel (Irene) must have deposited into another ledger channel with Bob. If Alice wants to execute her Uniswap trade with those deposited funds, she needs to close the ledger channel, withdraw the funds (in one L1 tx), and submit the trade (in another L1 tx).
47
+
In a typical state channel bridge architecture she must deposit funds into the ID of a "ledger channel" in a Singleton adjudicator contract. Her counterparty in that ledger channel (Irene) must have deposited into another ledger channel with Bob. If Alice wants to send Charley money using those deposited funds, she needs to close the ledger channel, withdraw the funds (in one L1 tx), and submit the transfer to Charley (in another L1 tx).
48
48
49
-
With the State Channel Bridge Wallet (SCBridge-Wallet) Architecture, she can instead propose the Uniswap trade to Irene, who checks that it doesn't compromise any HTLC payments, and then countersigns it and submits it to Alice's SCBridge-Wallet via en entrypoint contract. The SCBridge-Wallet validates the countersigned transaction and calls into Uniswap to execute the trade.
50
-
51
-
In either case, executing a multihop payment from Alice to Bob (white) is as easy as executing the well known HTLC (Hash Timelocked Contract) protocol, which is the same technology that powers the Bitcoin Lightning Network.
With the State Channel Bridge Wallet (SCBridge-Wallet) Architecture, she can instead send Irene the proposed transfer to Charley. Irene checks that this new payment doesn't compromise any HTLC payments, and then countersigns it and submits it to Alice's SCBridge-Wallet via en EntryPoint contract. The SCBridge-Wallet validates the countersigned transaction, then transfers some of the wallet funds to Charley.
Alice-#red>SCW-Alice: transfer 10 (direct from exchange, perhaps)
84
93
Bob->Irene: ledger Irene:10
85
94
Bob<-Irene: ack
86
95
Irene-#red>SCW-Bob: transfer 10
87
-
group L1 transaction flow
88
-
Alice->Irene: proposed uniswap trade
89
-
Irene-#red>SCW-Alice: countersigned uniswap trade
90
-
91
-
SCW-Alice->Uniswap: uniswap trade
96
+
group On-chain transaction flow
97
+
Alice->Irene: proposed transfer
98
+
Irene-#red>EntryPoint: countersigned transfer
99
+
EntryPoint-#red>SCW-Alice: transfer 10
100
+
SCW-Alice->Charley: transfer 10
101
+
end
92
102
end
103
+
-->
93
104
105
+
In either case, executing a multihop payment from Alice to Bob is as easy as executing the well known HTLC (Hash Timelocked Contract) protocol, which is the same technology that powers the Bitcoin Lightning Network.
94
106
95
-
end
107
+

108
+
109
+
<!-- diagram source, edit at sequencediagram.org
110
+
fontawesome f182 Alice
111
+
fontawesome f233 Irene
112
+
fontawesome f183 Bob
96
113
97
-
group Multihop L2 payment from Alice to Bob via Irene
114
+
group Off-chain payment from Alice to Bob via Irene
This repo originated as an entry for the ETHGlobal 2023 hackathon. Therefore some shortcuts were taken to enable an end-to-end demo given the time constraints. The following list identifies future areas for improvement if this foundation was used to build a production-ready application.
128
+
This repo originated as an entry for the ETHGlobal 2023 hackathon. Therefore the code takes some shortcuts to enable an end-to-end demo given the time constraints. The following list identifies future areas for improvement if this foundation was used to build a production-ready application.
112
129
113
130
1.`Messaging`: currently in-browser [BroadcastChannels](https://nodejs.org/api/worker_threads.html#class-broadcastchannel-extends-eventtarget) are used to communicate between the different users. A proper messaging service should allow users to exchange messages when they are on different machines with different IP addresses. Possible technologies include: WebSockets, WebRTC, HTTP requests, etc.
114
131
2.`Key management`: currently the private signing keys used by each user to sign blockchain txs and state channel messages are stored in a static [.env](./.env) file. These keys are read by the browser code and inserted in the the JavaScript running on the page. Since these keys control the movement of funds, they should be stored more securely, i.e. in Metamask or another crypto wallet.
0 commit comments