segwit lightning sidechains segwit
play

Segwit, Lightning, Sidechains Segwit Encountered in 2 - PowerPoint PPT Presentation

Segwit, Lightning, Sidechains Segwit Encountered in 2 presentations Segwit Core idea: Transaction data structure: <Inputs, Outputs, Scripts> Scripts? <Signature, Pubkeys> TXID = H(<Inputs, Outputs,


  1. Segwit, Lightning, Sidechains

  2. Segwit • Encountered in 2 presentations

  3. Segwit • Core idea: • Transaction data structure: • <Inputs, Outputs, Scripts> • Scripts? • <Signature, Pubkeys> • TXID = H(<Inputs, Outputs, Scripts>)

  4. Segwit • Bitcoin has a 1MB block limit • Script is large • takes up good chunk of this limit • Increase # of transactions by making this leaner

  5. Segwit • Script: • Alice -> Bob • Alice’s public key • Signature with Alice’s private key • Bob’s public key

  6. Segwit • Script: • Alice -> Bob • Alice’s public key • Signature with Alice’s private key • Bob’s public key

  7. Segwit • Move Alice’s public key and signature (witness) out of the transaction • Witness data in a new field • New merkle tree root from witnesses • Placed into input of coinbase

  8. Segwit • If you are running a pre-segwit node: • You see similar data (i.e you ignore witness) • And get blocks with a lot more transactions • Post segwit: • Lot more transactions and a new witness field • Remember, no protocol level change

  9. Issues • Pre-segwit nodes see a lot of txns • That seemingly are spent by anyone • Blocks from pre-segwit nodes • Won’t be accepted by post-segwit nodes • Blocks from post-segwit nodes • Won’t be accepted by pre-segwit nodes

  10. Pros • Transaction: • Alice -> Bob • <Inputs, Outputs, Bob’s public key> • Bob can compute TXID

  11. Segwit • How does Segwit help?

  12. Lightning Network

  13. Lightning Network • Transactions as fast as your communication allows • Not encumbered by protocol • Payment Channels • Records just 2 transactions - start and finish of economic activity

  14. Multisig • Multiple parties sign off • 2/3, 3/3, 2/2 etc.

  15. Payment Channels • Exchange Bitcoin Transactions • On a communication channel • Only broadcast the final

  16. Payment Channels • Transactions between a pair of individuals • Primitives: • Open • Send/Recv • Close

  17. Payment Channels • Open: • Between Alice, Bob • Record on the blockchain • Use a transaction • Output conditions?

  18. Open • Alice, Bob • Transaction • Inputs: Alice puts up 1 BTC • Output: 1 BTC, multisig(Alice, Bob) || (timelock(X), Alice)

  19. Output Cond. • multisig(Alice, Bob) || (timelock(X), Alice) • Both Alice & Bob have to agree to spend this • OR • When X blocks pass • Alice can spend it

  20. Broadcast This • This opens a channel

  21. Send Transactions Multisig(Alice, Bob) 1 BTC Alice 0.9 BTC Bob 0.1 BTC

  22. Send Transactions Multisig(Alice, Bob) 1 BTC Alice Alice Alice 0.9 BTC 0.8 BTC 0.5 BTC Bob Bob Bob 0.1 BTC 0.2 BTC 0.5 BTC

  23. Closing • Bob picks on of these • (presumably the best one) • And broadcasts it • Alice can’t • Why?

  24. Timeout Clause • Why?

  25. This Channel • One way • Bob can’t (shouldn’t) pay Alice • Why? • Only Alice Pays Bob

  26. Bidirectional How? • Issues: • Can’t revoke old transactions • Bitcoin only has timelock, no expiry • Only way to invalidate is to spend with another txn • What is the point of the channel then

  27. Trick • Change the primitives • Previously: • Multisig(Alice, Bob) | (Alice & timelock(X))

  28. Trick • Now: • Temporary key for transaction. • Timelock of 1 day • Alice, Bob, Bob-Temp

  29. Open Multisig(Alice, Bob) • Same 1 BTC

  30. Alice & Bob States Multisig(Alice, Bob) OR Multisig(Alice, Bob) OR Alice & Timelock(X) Alice & Timelock(X) 1 BTC 1 BTC Multisig(Alice-Temp, Bob) OR Alice Alice & Timelock(1) 0.9 BTC 0.9 BTC Multisig(Alice, Bob-Temp) OR Bob Bob & Timelock(1) 0.1 BTC 0.1 BTC

  31. Multisig(Alice, Bob) OR Multisig(Alice, Bob) OR Alice & Timelock(X) Alice & Timelock(X) 1 BTC 1 BTC Multisig(Alice-Temp2, Bob) OR Alice Alice & Timelock(1) 0.8 BTC 0.8 BTC Multisig(Alice, Bob-Temp2) OR Bob Bob & Timelock(1) 0.2 BTC 0.2 BTC Multisig(Alice-Temp, Bob) OR Alice Alice & Timelock(1) 0.9 BTC 0.9 BTC Multisig(Alice, Bob-Temp) OR Bob Bob & Timelock(1) 0.1 BTC 0.1 BTC Revoke

  32. Revoke Old • Alice sends Bob Alice-Temp • Bob sends Alice Bob-Temp • Why? • In what sequence?

  33. You Have • A Sequence of Payments!

  34. Need To • Keep track of all temp keys • Data structure called GGM

  35. Network • Multiple bidirectional channels • Alice <-> Bob <-> Manuel <-> Silvio

  36. Alice -> Manuel • Alice Pays Bob • Bob Pays Manuel • Thus Alice -> Manuel • Make this work?

  37. Hash/Time Locked Contract • Nonce!

  38. Hash/Time Locked Contract Multisig(Alice, Bob) OR Multisig(Alice, Bob) OR Alice & Timelock(X) Alice & Timelock(X) 1 BTC 1 BTC Alice Alice 0.8 BTC 0.8 BTC Multisig(Alice, Bob-Temp2) OR Multisig(Alice, Bob-Temp2) OR Bob & R & Timelock(1) Manuel & R & Timelock(1) 0.2 BTC 0.2 BTC Alex and Manuel communicate What do they communicate? Manuel knows R Sends Alice H(R) Test is knowledge of R

  39. Sidechains

  40. Sidechain • Take your bitcoin to a different blockchain • Use it there • Move it back • Trustless 2-way peg

  41. Why? • Innovations not possible on BTC • Using the ledges for a variety of things?

  42. Examples • Liquid • Connects exchanges and payment providers • Avoid going to the chain for transfers • Large payments, large providers

  43. Peg • A transaction in 1st chain locks coins • Reference in 2nd chain • (Some kind of swap) • 2-way means both directions • Some exchange rate

  44. Verification • Centralized authority • N of m authorities (federated peg) • Simplified Payment Verification

  45. SPV • Show miners have mined blocks on top of the block containing the locked transaction • Build a merkle tree and this is a “proof” • Can counter this proof showing a longer chain without this transaction

  46. Questions?

Recommend


More recommend