84
$ www.bitcoinjs.org Creative Commons 3.0 Attribution A divorce and new beginnings Stefan Thomas • WeUseCoins.com BitcoinJS

BitcoinJS Webtuesday Presentation

Embed Size (px)

Citation preview

Page 1: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

A divorce and new beginnings

Stefan Thomas • WeUseCoins.com

BitcoinJS

Page 2: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

Page 3: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

Page 4: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

- Web developer 13 years

Page 5: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

- Web developer 13 years

- Bitcoin evangelist

Page 6: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

- Web developer 13 years

- Bitcoin evangelist 6 months

Page 7: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

- Web developer 13 years

- Bitcoin evangelist 6 months

Page 8: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

login

- Web developer 13 years

- Bitcoin evangelist 6 months

Page 9: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

ls

- What’s Bitcoin? (1 slide version) - Things that are... sub-optimal - Node.js to the rescue!

Page 10: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

man bitcoin

Page 11: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

man bitcoin

- Limited set of tokens

Page 12: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

man bitcoin

- Limited set of tokens - Decentralized

Page 13: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

man bitcoin

- Limited set of tokens - Decentralized - Open-Source

Page 14: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

man bitcoin

- Limited set of tokens - Decentralized - Open-Source

= Internet Money

Page 15: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

Page 16: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

Page 17: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

140000 x

Page 18: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

140000 x

= 620 MB

Page 19: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

140000 x

= 620 MB => 6-24 hours

Page 20: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wget blk*.dat

140000 x

= 620 MB => 6-24 hours

Page 21: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

Page 22: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

VirtualBox Dropbox Ironkey +

Truecrypt

Page 23: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

VirtualBox Dropbox Ironkey +

Truecrypt

Page 24: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

VirtualBox Dropbox Ironkey +

Truecrypt

Page 25: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

VirtualBox Dropbox Ironkey +

Truecrypt

Page 26: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

VirtualBox Dropbox Ironkey +

Truecrypt

Page 27: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

Page 28: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

rm wallet.dat

Page 29: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

These additions include nine new SCADA exploits, improved 64-

bit Linux payloads, exploits for Firefox and Internet Explorer,

full-HTTPS and HTTP Meterpreter stagers, and post-exploitation

modules for dumping passwords from Outlook, WSFTP,

CoreFTP, SmartFTP, TotalCommander, BitCoin and many other

applications.

Metasploit 4.0

Page 30: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

These additions include nine new SCADA exploits, improved 64-

bit Linux payloads, exploits for Firefox and Internet Explorer,

full-HTTPS and HTTP Meterpreter stagers, and post-exploitation

modules for dumping passwords from Outlook, WSFTP,

CoreFTP, SmartFTP, TotalCommander, BitCoin and many other

applications.

Metasploit 4.0

Page 31: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

Metasploit 4.0 blah new post exploitation modules

Page 32: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

Metasploit 4.0 blah new post exploitation modules

blah blah for dumping passwords blah

Page 33: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

Metasploit 4.0

Blah, BitCoin, Blah, …

blah new post exploitation modules

blah blah for dumping passwords blah

Page 34: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

scp wallet.dat

Metasploit 4.0

Blah, BitCoin, Blah, …

blah new post exploitation modules

blah blah for dumping passwords blah

Page 35: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Page 36: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain

Page 37: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

uml blockchain

Page 38: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain

Page 39: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI

Page 40: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

Page 41: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

Page 42: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

-> Server

Page 43: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

• Complex • Personal • Private

-> Server

Page 44: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

• Complex • Personal • Private

-> Server -> Client

Page 45: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

• Complex • Personal • Private

• Simple • Personal • Secret!!

-> Server -> Client

Page 46: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

cat cmn_sense.txt

Block chain UI Wallet

• HUGE!! • Global • Public

• Complex • Personal • Private

• Simple • Personal • Secret!!

-> Server -> Client -> Hardware (ideally)

Page 47: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node

Page 48: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node • Realtime

Page 49: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node • Realtime • JSON-RPC

Page 50: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node • Realtime • JSON-RPC • Lots of concurrent users

Page 51: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node • Realtime • JSON-RPC • Lots of concurrent users

Page 52: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

find platform

Block chain server • Peer-to-peer node • Realtime • JSON-RPC • Lots of concurrent users

+

Page 53: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Page 54: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Memory leaks! Example: MongooseJS

Page 55: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Memory leaks! Collection.prototype.addQueue = function (name, args) { this.queue.push([name, args]); return this; }; Collection.prototype.doQueue = function () { for (var i = 0, l = this.queue.length; i < l; i++){ this[this.queue[i][0]].apply(this, this.queue[i][1]); } return this; };

Example: MongooseJS

Page 56: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Memory leaks! Collection.prototype.addQueue = function (name, args) { this.queue.push([name, args]); return this; }; Collection.prototype.doQueue = function () { for (var i = 0, l = this.queue.length; i < l; i++){ this[this.queue[i][0]].apply(this, this.queue[i][1]); } this.queue = []; return this; };

Example: MongooseJS

+

Page 57: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Memory leaks! saw.chain = function () { var ch = Traverse(saw.handlers).map(function (node) { // ... if (typeof node === 'function') { this.update(function () { saw.actions.push({ path : ps, args : [].slice.call(arguments) }); return ch; }); }

Example: node-binary

Page 58: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Lesson

Page 59: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Lesson Node.js libraries can be strange

Page 60: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Lesson Node.js libraries can be strange

Page 61: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Lesson Node.js libraries can be strange

But overall it’s not that bad!

Page 62: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Lesson Node.js libraries can be strange

But overall it’s not that bad!

Also: V8’s GC is very good!

Page 63: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Debugging Tip: “LiveObjectList”

# Compile V8 with LiveObjectList support scons liveobjectlist=on ... # Run your program with debugging node --debug my_leaky_program.js # Connect to your program with D8 d8 --remote_debugger

Getting set up

Page 64: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js

Debugging Tip: “LiveObjectList”

lol c Capture a heap snapshot lol Show heap snapshots lol list List objects in a snapshot lol diff [s1] [s2] Show differences between snapshots lol path [obj_id] Show retaining paths for an object

Usage

Page 65: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js moon@clymene:~/opt/node$ deps/v8/d8 --remote_debugger > Type: connect V8-Version: 3.1.8.26 Protocol-Version: 1 Embedding-Host: node v0.4.10 stopped dbg> lol c Captured live object list 1: count 156079 size 8129300 dbg> c (running) > stopped dbg> lol c Captured live object list 2: count 173343 size 8374416 dbg>

Page 66: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js dbg> gc GC 7809868 => 6710536 (7.4M => 6.4M) dbg> lol diff 1 2 v t Array 1000 objects: [ 1] @222138: size 16, 0xb39bd329 <JSArray> len 0 [ 2] @222139: size 16, 0xb39bd339 <JSArray> len 0 [ 3] @222143: size 16, 0xb39bd3a1 <JSArray> len 0 [ 4] @222144: size 16, 0xb39bd3b1 <JSArray> len 0 [ 5] @222145: size 16, 0xb39bd3c1 <JSArray> len 0 [ 6] @222365: size 16, 0xb39bede5 <JSArray> len 0 [ 7] @222498: size 16, 0xb39bfea5 <JSArray> len 0 [ 8] @222615: size 16, 0xb39c0d55 <JSArray> len 3 ... dbg> lol path @222138

Page 67: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

d8 server.js | | V [274] @79332 0xb4422699: size 20 : HeapObject DescriptorArray FixedArray 0xb4422699: [FixedArray] - length: 3 [0]: 0xb77b3efd <FixedArray[53]> [1]: 0xb577404d <undefined> [2]: 0xb41eddd9 <JS array[0]> | | V [275] @215108 0xb41eddd9: size 16 : HeapObject JSObject JSArray 0xb41eddd9: [JSObject] - map = 0xb5754861 - prototype = 0xb77b4f49 { #length: 0xb577e581 <Proxy> (callback) #_cast: (null descriptor) } =====================================

Page 68: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

uname -a

Another thing… 32 bit 64 bit

Page 69: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

uname -a

Another thing…

- V8 heap limit

32 bit 64 bit

1 GB 1.9 GB

Page 70: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

uname -a

Another thing…

- V8 heap limit

- MongoDB database

32 bit 64 bit

2.5 GB

1 GB 1.9 GB

Page 71: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

bitcoinjs run

Now STOP!

Page 72: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

bitcoinjs run

Demo time! Now STOP!

Page 73: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

forecast

Lots more to be done!

- GUI

- Wallet

- Shopping Cart Interface

Page 74: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

git clone bitcoinjs-gui

A matching client!

- JS-based crypto (fun stuff!)

Page 75: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

git clone bitcoinjs-gui

A matching client!

- JS-based crypto (fun stuff!)

- HTML5 LocalStorage

Page 76: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

git clone bitcoinjs-gui

A matching client!

- JS-based crypto (fun stuff!)

- HTML5 LocalStorage

- Socket.IO

Page 77: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

git clone bitcoinjs-gui

A matching client!

Page 78: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

git clone bitcoinjs-gui

A matching client!

- Beta August 2011

- Screencast: http://www.youtube.com/watch?v=KTmFwnIRG9c

Page 79: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wallet 2.0

Ideas for a more secure wallet

Page 80: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wallet 2.0

Ideas for a more secure wallet

- Deterministic Wallet

Page 81: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wallet 2.0

Ideas for a more secure wallet

- Deterministic Wallet

- Distributed Key Generation

Page 82: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

wallet 2.0

Ideas for a more secure wallet

- Deterministic Wallet

- Distributed Key Generation

- Hardware Device

Page 83: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

exit

Thank you And good night!

Page 84: BitcoinJS Webtuesday Presentation

$

www.bitcoinjs.org Creative Commons 3.0 Attribution

tail -f

Meetup this Saturday! Oliver Twist Pub 16:30

@bitcoinjs

github.com/bitcoinjs