Bitcoin Smart Contracts
Saravanan Vijayakumaran sarva@ee.iitb.ac.in
Department of Electrical Engineering Indian Institute of Technology Bombay
August 26, 2019
1 / 17
Bitcoin Smart Contracts Saravanan Vijayakumaran sarva@ee.iitb.ac.in - - PowerPoint PPT Presentation
Bitcoin Smart Contracts Saravanan Vijayakumaran sarva@ee.iitb.ac.in Department of Electrical Engineering Indian Institute of Technology Bombay August 26, 2019 1 / 17 Smart Contracts Computer protocols which help execution/enforcement of
Department of Electrical Engineering Indian Institute of Technology Bombay
1 / 17
2 / 17
4 / 17
5 / 17
nVersion Number of Inputs N Input 0 . . . Input N − 1 Number of Outputs M Output 0 . . . Output M − 1 nLockTime Regular Transaction Format
7 / 17
8 / 17
9 / 17
Start nSequence[31] = 1? k = nSequence[15:0] nSequence does not encode a relative lock time nSequence[22] = 1? Relative lock time is k × 512 seconds Relative lock time is k blocks Yes No Yes No
10 / 17
12 / 17
Alice Bob R e q u e s t p u b l i c k e y S e n d P u b K e y A Create PubKeyB Create t1 Create t2 S e n d t2 w i t h B ’ s s i g S e n d t2 w i t h A ’ s s i g
13 / 17
time expires
then Alice is guaranteed 0.0001 bitcoins if she broadcasts e1 before lock time on t2 expires.
Alice Bob Network R e q u e s t p u b l i c k e y S e n d P u b K e y A Create PubKeyB Create t1 Create t2 S e n d t2 w i t h B ’ s s i g S e n d t2 w i t h A ’ s s i g B r
d c a s t t
1
t
1
c
fi r m a t i
S e n d d
u m e n t S e n d e1 w i t h A ’ s s i g a n d p a g e 1 e d i t s S e n d e1 w i t h B ’ s s i g
14 / 17
terminates the contract. Alice broadcasts e1 and receives 0.0001 BTC.
then Alice is guaranteed 0.0002 bitcoins if she broadcasts e2 before lock time on t2 expires.
Alice Bob Network Request public key Send PubKeyA Create PubKeyB Create t1 Create t2 Send t2 with B’s sig Send t2 with A’s sig Broadcast t1 t1 confirmation Send document Send e1 with A’s sig and page 1 edits Send e1 with B’s sig Send e2 with A’s sig and page 2 edits Send e2 with B’s sig
. . .
Send e100 with A’s sig and page 100 edits Send e100 with B’s sig B r
d c a s t e
1
e
1
c
fi r m a t i
15 / 17
16 / 17
17 / 17