Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Payment Channel

Introduction
2017/10/03 blockchain.tokyo #1
@mosa_siru
@mosa_siru ( )
•
• TV
• Gunosy
PO
@mosa_siru as engineer
•
• (DeNA)
• (Gunosy)
• (Gunosy)
1. Payment channel
2. HTLCs
bitcoin micro payment
•
• (API )
• bitcoin 1 1
• 2017/10 150
• ( ) 10
• 3.47
• platform


user
• platform user
• platform BTC 

user 10 

platform BTC
• user platform
•
• platform
Payment channel
• trustless ( )
• off-chain transaction(
broadcast )
• off-chain
Multisig
• 

( ) of ( )
• 2 of 3 ( 3 2
• 1 of 2 ( )
• 2 of 2 ( )
P2SH Redeem script: OP_2 [A's pubkey] [B's pubkey] OP_2 O...
CLTV(CheckLockTimeVerify)
• BIP65 (Final) (OP_CHECKLOCKTIMEVERIFY)
• unspentable


( BTC )
※ nLockTime
( UTXO )
CSV(CheckSequenceVerify)
• BIP112 (Final) (OP_CHECKSEQUENCEVERIFY)
• (
) unspentable 

BTC (3 )
•
• CLTV CSV TimeLock
Payment Channel
Payment Channel
• trustless(A, B )
• trustless 2 of 2 multisig(A, B
)
• fund
• off-chain
(100 )
Payment Channel (1)
A → B micro payment
1. A 2 of 2(multisig) fund 1BTC deposite
broadcast
2. 1 txid 1 1BTC A
refund trans...
Payment Channel (2)
4. deposite address A, B
A B
(off-chain)


deposite address => B(0.01BTC), A(0.99BTC) 

deposite addre...
Bob => Alice
https://bitcoin.org/en/developer-guide#micropayment-channel
Trustless (1)
• B
• refund transaction( ) broadcast 1 (CSV
or CLTV) A
• refund transaction B B
fund deposite
• B 1 A
Trustless (2)
• A
• B broadcast
Time Lock
• refund CLTV( )
channel close (B )
CSV( )
• CLTV nLockTime(
)
• deposite txid
refund transaction 

segwit
•
• channel
• deposite
•
HTLC
HTLC

(Hashed TimeLock Contracts)
• CSV, CTLV TimeLock HashLock
• A => B => C
• channel
• B A
• Lightning Network
HTLC (1)
A => C micro payment
1. A => B , B => C payment channel
2. C A r
hash(r)
generate rOpen
channel
Open
channel
HTLC (2)
3. A => B 1BTC tx1 (off-chain)

IF
1. B r
2. 10 A (CLTV) ※refund .
4. Tx1 B => C 1BTC tx2 (off-chain)
1. C r
2. 5...
HTLC (1)
• trustless A => B => C
•
• tx2 tx1 refund B
CSV
CLTV tx2
HTLC (2)
• Tx1 (A => B) tx2
segwit
id
• r
pre-image
Payment Channel

(Bidirectional)
Payment Channel
(Bidirectional)
• payment channel
• channel 2
fund
• Time Lock, Hash Lock
Payment Channel
(Bidirectional)
1. A, B 5BTC 2 of 2 fund
opening transaction (off-chain)
2. A secret1, B secret2( )
hash
Payment Channel
(Bidirectional)
3. A commitment transaction tx2 B (off-chain)
4. B commitment transaction tx1 A (off-chain...
Payment Channel
(Bidirectional)
A => B 1BTC
5. tx3, tx4 secret
6. Secret 1, 2 hash tx1, tx2
transaction
• A => B 1BTC A tx1, tx2
secret
• A tx1 broadcast A 5BTC
100block B 5BTC
secret1 10BTC
Payment Channel
(Bidirectional)
7. transaction broadcast
•
layer2
• CTLV, CSV
•
trustless
• …
@mosa_siru
Payment Channel Introduction
Payment Channel Introduction
Upcoming SlideShare
Loading in …5
×

Payment Channel Introduction

11,711 views

Published on

The detailed introduction of bicoin's payment channel, base of lightning network.

Published in: Technology
  • Be the first to comment

Payment Channel Introduction

  1. 1. Payment Channel
 Introduction 2017/10/03 blockchain.tokyo #1 @mosa_siru
  2. 2. @mosa_siru ( ) • • TV • Gunosy PO
  3. 3. @mosa_siru as engineer • • (DeNA) • (Gunosy) • (Gunosy)
  4. 4. 1. Payment channel 2. HTLCs
  5. 5. bitcoin micro payment • • (API ) • bitcoin 1 1 • 2017/10 150 • ( ) 10 • 3.47
  6. 6. • platform 
 user • platform user
  7. 7. • platform BTC 
 user 10 
 platform BTC • user platform • • platform
  8. 8. Payment channel • trustless ( ) • off-chain transaction( broadcast ) • off-chain
  9. 9. Multisig • 
 ( ) of ( ) • 2 of 3 ( 3 2 • 1 of 2 ( ) • 2 of 2 ( ) P2SH Redeem script: OP_2 [A's pubkey] [B's pubkey] OP_2 OP_CHECKMULTISIG
  10. 10. CLTV(CheckLockTimeVerify) • BIP65 (Final) (OP_CHECKLOCKTIMEVERIFY) • unspentable 
 ( BTC ) ※ nLockTime ( UTXO )
  11. 11. CSV(CheckSequenceVerify) • BIP112 (Final) (OP_CHECKSEQUENCEVERIFY) • ( ) unspentable 
 BTC (3 ) • • CLTV CSV TimeLock
  12. 12. Payment Channel
  13. 13. Payment Channel • trustless(A, B ) • trustless 2 of 2 multisig(A, B ) • fund • off-chain (100 )
  14. 14. Payment Channel (1) A → B micro payment 1. A 2 of 2(multisig) fund 1BTC deposite broadcast 2. 1 txid 1 1BTC A refund transaction 
 B CSV CLTV 3. 1 broadcast (channel open
  15. 15. Payment Channel (2) 4. deposite address A, B A B (off-chain) 
 deposite address => B(0.01BTC), A(0.99BTC) 
 deposite address => B(0.02BTC), A(0.98BTC)
 … 5. B broadcast (channel close)
  16. 16. Bob => Alice https://bitcoin.org/en/developer-guide#micropayment-channel
  17. 17. Trustless (1) • B • refund transaction( ) broadcast 1 (CSV or CLTV) A • refund transaction B B fund deposite • B 1 A
  18. 18. Trustless (2) • A • B broadcast
  19. 19. Time Lock • refund CLTV( ) channel close (B ) CSV( ) • CLTV nLockTime( ) • deposite txid refund transaction 
 segwit
  20. 20. • • channel • deposite •
  21. 21. HTLC
  22. 22. HTLC
 (Hashed TimeLock Contracts) • CSV, CTLV TimeLock HashLock • A => B => C • channel • B A • Lightning Network
  23. 23. HTLC (1) A => C micro payment 1. A => B , B => C payment channel 2. C A r hash(r) generate rOpen channel Open channel
  24. 24. HTLC (2) 3. A => B 1BTC tx1 (off-chain)
 IF 1. B r 2. 10 A (CLTV) ※refund . 4. Tx1 B => C 1BTC tx2 (off-chain) 1. C r 2. 5 B (CTLV) ← tx1 5. C r tx2 broadcast 1BTC r B tx1 broadcast 1BTC
  25. 25. HTLC (1) • trustless A => B => C • • tx2 tx1 refund B CSV CLTV tx2
  26. 26. HTLC (2) • Tx1 (A => B) tx2 segwit id • r pre-image
  27. 27. Payment Channel
 (Bidirectional)
  28. 28. Payment Channel (Bidirectional) • payment channel • channel 2 fund • Time Lock, Hash Lock
  29. 29. Payment Channel (Bidirectional) 1. A, B 5BTC 2 of 2 fund opening transaction (off-chain) 2. A secret1, B secret2( ) hash
  30. 30. Payment Channel (Bidirectional) 3. A commitment transaction tx2 B (off-chain) 4. B commitment transaction tx1 A (off-chain) 100block secret 
 opening transaction broadcast.
  31. 31. Payment Channel (Bidirectional) A => B 1BTC 5. tx3, tx4 secret 6. Secret 1, 2 hash tx1, tx2
  32. 32. transaction • A => B 1BTC A tx1, tx2 secret • A tx1 broadcast A 5BTC 100block B 5BTC secret1 10BTC
  33. 33. Payment Channel (Bidirectional) 7. transaction broadcast
  34. 34. • layer2 • CTLV, CSV • trustless • …
  35. 35. @mosa_siru

×