state channels and scalability
TRANSCRIPT
PROBLEMS ADDRESSED BY STATE CHANNELSScalability - Tens of thousands transactions per second possible
Privacy - None public transaction possible
Confirmation delay: instant transaction confirmation possible
-> Still trustless/ without counter party risk
BITCOIN - PAYMENT CHANNELAlice wants to charge a E-car and pay Bob every second
A locks money in a multisig address (2 out of 2)
100mBTC in multisig: 1) Alice signs transaction with two outputs 1mBTC to Bob, 99 to Alice 2) Alice signs transaction with two outputs 2mBTC to Bob, 98 to Alice 3) Alice signs transaction with two outputs 3mBTC to Bob, 97 to Alice
…. Only Bob can submit transactions because his signature is missing Bob would only submit the latest transaction
BITCOIN - PAYMENT CHANNELLimitations: Payments only in one direction
Next step: Lightning network - invalidate older transactions by punishment transaction
1) Alice signs transaction with two outputs 1mBTC to Bob, 99 to Alice 2) Alice signs transaction with two outputs 2mBTC to Bob, 98 to Alice 3) Alice signs transaction with two outputs 3mBTC to Bob, 97 to Alice
Bob signs a transaction that would spend the 3mBTC With Ethereum: Much simpler and in a general way possible
SEQUENCE OF STATE CHANNELS1. two (or more) people lock up some tokens or any state description they totally control. 2. this state can only be updated on the blockchain with a signed message of all group members 3. the members of the group can internally do transactions by creating a new state and letting it sign by everyone. The new state also has a nonce (sequence number) 4. if members of the group stop cooperating the latest state can always be written on the blockchain 5. to write the state on the blockchain anyone can submit a signed state and a small security deposit - this will trigger a challenge period. During this period a newer state (higher nonce) can be submitted, in this case the first submitter would lose its deposit. 6. If a state remains unchallenged it will be written on the regular blockchain
EXAMPLE - PREDICTION MARKETAlice and Bob wants to bet against each other.
1. Lock money
2. First transaction: Alice bets on Hillary, Bob on Sanders (could sign the transaction or just the resulting state)
seq. nr. 0 | (A:50ETH/B:50ETH) |
seq. nr. 1 | (A:40ETH, 20 Hillary shares/B:40ETH 20 Sanders shares) | signatures
EXAMPLE - PREDICTION MARKET3. Second transaction: Alice makes another bet on Hillary
seq. nr. 2 | (A:25ETH, 40 Hillary shares/B:35ETH 40 Sanders shares) | signatures
seq. nr. 1 | (A:40ETH, 20 Hillary shares/B:40ETH 20 Sanders shares) | signatures
4. Sanders wins 4a. If they cooperate they can just update the off-chain state to:
seq. nr. 3 | (A:25ETH,/B:75ETH) | signatures
4b. If Alice does not cooperate Bob can settle state 2 (submit it to the blockchain)4c. Alice could try to cheat and settle state 0 or 1 - > Bob can challenge this by submitting state 2 during the challenge period
HASHLOCK - (1/2) TRANSITIVE TRANSACTIONS
Alices - Bob Bob - Charly
seq. nr. 0 | (A:50ETH/B:50ETH) | seq. nr. 0 | (B:50ETH/C:50ETH) |
Alice wants to send Charly 10 ETH but hasn't locked money with him.
seq. nr. 1 | (A:40ETH/B:60ETH ) | signatures | HASHLOCK (only known by Alice)
Solution - Alices sends 10 ETH to Bob in channel 1 and Bob sends 10 to Charly in channel 2Problem - Who makes the first transaction? -> Hashlock
seq. nr. 1 | (B:40ETH/C:60ETH ) | signatures | SAME HASHLOCK (only known by Alice)
Alice can publish the HASH-LOCK
HASHLOCK - (2/2) TRANSITIVE TRANSACTIONS
seq. nr. 1 | (A:40ETH/B:60ETH ) | signatures | HASHLOCK (only known by Alice)
seq. nr. 1 | (B:40ETH/C:60ETH ) | signatures | SAME HASHLOCK (only known by Alice)
What if a) Alice creates the transaction to Bob but Bob does not create the
transaction to Charly-> than Alice does not reveal the Secret
b) Alice reveals the secret of the transaction only to Charly? -> as soon as Charly puts the secrete on the Blockchain Bob knows it as well
c) What if Alices does not reveal the secret at all?-> there needs to be an expiry date where funds are freed anyway
Alices - Bob Bob - Charly
FINAL THOUGHTS- more money locked than necessary - make a bid - revoke the bid mini - side chain The court
READ MOREOff chain trading on Gnosis http://forum.groupgnosis.com/t/how-offchain-trading-will-work/63/13
Intro to state channels http://www.jeffcoleman.ca/state-channels/
Universal Payment Channels https://gist.github.com/jtremback/058daafe1116435b6a2e
Bitcoin Lightning Network https://lightning.network