forked from haraldschilly/yagt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
445 lines (368 loc) · 14.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<!doctype html>
<html lang="en">
<head><meta charset="utf-8">
<title>BitcoinJ</title>
<meta name="description" content="BitcoinJ: DevFest 2012 Vienna, Austria Talk; Bitcoin client for Java and Android">
<meta name="author" content="Andreas Petersson, Harald Schilly">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/bitcoinj.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/github.css">
<script src="https://socketio.mtgox.com/socket.io/socket.io.js"></script>
<!-- <script src="lib/js/socket.io.js"></script> -->
<script>
// If the query includes 'print-pdf' we'll use the PDF print sheet
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body spellcheck="false">
<div class="reveal">
<!-- Used to fade in a background when a specific slide state is reached -->
<div class="state-background"></div>
<!-- breadcrumb note: each horizontal section should have a "bc" attribute
and each vertical one too. if the vertical one doesn't have one, the
title is derived from the first tag, iff it is a h1, h2 or h3.
Breadcrumb:
[html <title>] > [ hsection.bc ] > [ vsection.bc || vsection.h1,h2,h3]
-->
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section bc="">
<section>
<h1>BitcoinJ</h1>
<h3>JAVA / Android Library</h3>
<hr/>
<h3><a href="http://petersson.at/">Andreas Petersson</a> & <br/>
<a href="http://harald.schil.ly">Harald Schilly</a></h3>
<p><img class="noborder" src='res/Bitcoin-austria.svg' width="35%"/></p>
<aside class="footnote">
<a href="http://bitcoinaustria.github.com/devfest-bitcoinj/">bitcoinaustria.github.com/devfest-bitcoinj</a>
-
<a href="https://github.com/bitcoinaustria/devfest-bitcoinj">devfest-bitcoinj@github</a>
</aside>
</section>
</section>
<section data-markdown bc="Introduction">
<section data-markdown>
## What's Bitcoin?
<blockquote cite="http://bitcoin.org/">Bitcoin is an experimental new digital currency
that enables instant payments to anyone, anywhere in the world.
Bitcoin uses peer-to-peer technology to operate with no central authority:
managing transactions and issuing money are carried out collectively by the network.
</blockquote>
<div style="text-align: right">-- bitcoin.org</div>
<aside class="footnote"><a href="http://bitcoin.org">bitcoin.org</a></aside>
</section>
<section data-markdown>
## In Short
* <div style="color: red">You are your own bank!</div>
* Money is stored in <b>your</b> machine.
* worldwide
* instant
* <b>... and chargebacks are impossible!</b>
</section>
<section data-markdown bc="Differences">
## What's the differece?
* No middleman
* No contract
* No TOS to care about.
</section>
<section data-markdown>
## Scared?
You can also rely on a third-party service:
* [blockchain.info](https://blockchain.info/api): secure online wallet with an API
* [BitPay](https://bitpay.com/): full blown merchant solution
* [Paysius](http://paysius.com/): US only :(
* [WalletBit](https://walletbit.com/businesstools): POS solutions
</section>
<section data-markdown>
## Types of clients
* [Classic "Satoshi" client](http://www.bitcoin.org/)
* BitcoinJ
* Forks / Alternative Implementations
</section>
<section data-markdown>
## Resource Comparison
<ul>
<li>Satoshi client: 4800MB</li>
<li class="fragment">Multibit: 21MB</li>
<li class="fragment">BitcoinJ on Android: 5MB</li>
</ul>
</section>
<section data-markdown>
## Projects using BitcoinJ
* [Bitcoin Wallet for Android](https://play.google.com/store/apps/details?id=de.schildbach.wallet)
* [Multibit](http://multibit.org/)
* Satoshidice
* Tons of lesser known applications
</section>
<section data-markdown>
## BitcoinJ Project
* Started as a 20% project at Google
* First Rev: March 4th, 2011
* Main Devs: [Mike Hearn](https://plus.google.com/u/0/114798402540078632611), [Miron Cuperman](http://hyper.to/blog/), [Matt Corallo](https://github.com/TheBlueMatt)
* Apache 2.0 Licensed
* Still actively developed; alpha stage
<div style="font-size: 140%">↠ <a href="http://bitcoinj.org">BitcoinJ Website</a> ↞</div>
<aside class="footnote">
</aside>
</section>
<section data-markdown>
## Goals
* Java implementation of the Bitcoin protocol
* Lightweight client for the Android ecosystem
* Simple library for desktop applications
* Suiteable for server-side processing
</section>
<section data-markdown>
## Main Features
<ul>
<li class="fragment">Manage a local Bitcoin wallet (no server!)</li>
<li class="fragment">Connect and listen to other Bitcoin nodes directly</li>
<li class="fragment">Send/recieve Bitcoins w/o storing the full blockchain (simplified payment
verification)
</li>
</ul>
</section>
<section data-markdown>
## Ingredients
* Public/Private Key in Wallet
* Connection to Peers
* Storage of past transactions (if necessary)
</section>
<section data-markdown>
## Security
BitcoinJ relies on the network to verify transactions.
Only valid transactions are propagated and BitcoinJ
checks if it receives its own transactions.
</section>
<section data-markdown data-state="alert">
## BitcoinJ is not ...
* a full Bitcoin node
* fire-and-forget
* 1.0 quality release
</section>
</section>
<section bc="API">
<section data-markdown>
## The API
<h1 style="color: red">Show us the code!</h1>
<aside class="footnote">
<a href="http://code.google.com/p/bitcoinj/wiki/GettingStarted">BitcoinJ Wiki: Getting Started</a>
</section>
<section>
<h2>Wallet</h2>
<pre><code class="java">File walletFile = new File("coins.dat");
try {
wallet = Wallet.loadFromFile(walletFile);
} catch (IOException e) {
wallet = new Wallet(params);
wallet.addKey(new ECKey());
wallet.saveToFile(walletFile);
}
</code></pre>
</section>
<section>
<h2>Network Type</h2>
For testing
<pre><code class="java">NetworkParameters params =
NetworkParameters.testNet()
</code></pre>
For production:
<pre><code class="java">NetworkParameters params =
NetworkParameters.prodNet();
</code></pre>
</section>
<section>
<h2>Address</h2>
Transform a public address to ...
<pre><code class="java">Address a1 =
new Address(params, "1HaSchNbFfLF8MJw41QNie7RPePPqdTozb");
</code></pre>
→ <a href=="http://blockchain.info/address/1HaSchNbFfLF8MJw41QNie7RPePPqdTozb">1HaSchNbFfLF8MJw41QNie7RPePPqdTozb</a>
</section>
<section>
<h2>Public/Private Key</h2>
<pre><code class="java">ECKey key = new ECKey();
byte[] publicKey = key.getPubKey();
</code></pre>
Gets the address corresponding to the public key.
<pre><code class="java">Address addr = key.toAddress(params);
System.out.println(addr.toString());
</code></pre>
1HwBZk111V4eEEC4BcN8fZd3RVifig2WjY
</section>
<section>
<h2>Connect to Network</h2>
<pre><code class="java">final PeerGroup peerGroup =
new PeerGroup(blockStore, params, chain);
peerGroup.setUserAgent("MyApp", "1.2");
peerGroup.addWallet(wallet);
peerGroup.addAddress(
new PeerAddress(InetAddress.getLocalHost()));
peerGroup.start();
</code></pre>
</section>
<section>
<h2>Payment Notification</h2>
<pre><code class="java">wallet.addEventListener(
new AbstractWalletEventListener() {
public void onCoinsReceived(
Wallet w,
Transaction tx,
BigInteger prevBalance,
BigInteger newBalance) {
// Running on a peer thread.
}
});
</code></pre>
</section>
<section>
<h2>Introspect Payment</h2>
<pre><code class="java">// Wallet w, Transaction tx;
TransactionInput input = tx.getInputs().get(0);
Address from = input.getFromAddress();
BigInteger value = tx.getValueSentToMe(w);
println(Utils.bitcoinValueToFriendlyString(value));
</code></pre>
Note: For each payment request, generate a new address.
</section>
<section>
<h2>Send a Payment</h2>
<pre><code class="java">// Address to; Wallet w
Wallet.SendResult sendResult =
w.sendCoins(peerGroup, to, value);
println("Sent coins! TX=" +
sendResult.tx.getHashAsString());
</code></pre>
Note: sendResult could be <code>null</code>.
</section>
</section>
<section bc="Final Words">
<section data-markdown>
## The Future of BitcoinJ
* Full verification capability
* Multisig support
* External hardware wallets
* Bloom filtering
</section>
<section data-markdown>
## Bitcoin Network
* No middleman: only *your* piece of software
* No contract
* No TOS to care about.
</section>
<section bc="Links">
<table style="width:100%;">
<tr>
<td>
<h2>Talk</h2>
</td>
<td>
<ul>
<li><a href="http://github.com/bitcoinaustria/devfest-bitcoinj">Sources for this talk</a></li>
<li><b><a href="http://www.bitcoin-austria.at/">Bitcoin Austria Organization</a></b></li>
</ul>
</td>
</tr>
<tr>
<td>
<h2>Bitcoin</h2>
</td>
<td>
<ul>
<li><a href="http://www.bitcoin.org/">Bitcoin</a></li>
<li><a href="http://weusecoins.org">we use coins</a></li>
<li><a href="http://en.wikipedia.org/wiki/Bitcoin">Bitcoin @ Wikipedia</a></li>
</ul>
</td>
</tr>
<tr>
<td>
<h2>BitcoinJ</h2>
</td>
<td>
<ul>
<li><b><a href="http://code.google.com/p/bitcoinj/">BitcoinJ</a></b></li>
<li><a href="http://www.javaworld.com/javaworld/jw-01-2012/120110-bitcoin-for-beginners-3.html">Java World Article</a></li>
<li><a href="http://code.google.com/p/bitcoin-wallet/">Bitcoin Wallet 4 Android</a></li>
</ul>
</ul>
</td>
</tr>
</table>
</section>
<section bc="Copyright">
<h2><b>© 2012 <a href="http://harald.schil.ly/">Harald Schilly</a> &
<a href="http://petersson.at">Andreas Petersson</a></b></h2>
<hr/>
<h3><a href="http://github.com/haraldschilly/yagt">devfest-bitcoinj@github</a></h3>
<h3>License: <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA</a></h3>
<p>Based on work by <a href="http://hakim.se">Hakim El Hattab</a><br/>
Details: <code>git blame</code> ;-)</p>
</section>
</section>
</div>
<!-- bottom left corner logo -->
<aside class="logo">
<a class="image" href="http://www.bitcoin-austria.at/"><img src="res/Bitcoin-austria.svg" /></a>
</aside>
<!-- counter top right -->
<aside id="counters">
<p id="cnt-hori">-</p>
<p id="cnt-hori-all">-</p>
<p id="cnt-vert">-</p>
<p id="cnt-vert-all">-</p>
</aside>
<!-- The navigational controls UI -->
<aside class="controls">
<a class="left" href="#">◄</a>
<a class="right" href="#">►</a>
<a class="up" href="#">▲</a>
<a class="down" href="#">▼</a>
</aside>
<!-- time -->
<aside id="time"></aside>
<!--header-->
<aside id="header">
<!-- breadcrumb at the top -->
<aside id="breadcrumb"></aside>
<!--ticker-->
<aside id="ticker"></aside>
</aside>
<!-- footnote in bottom middle. enter text via <aside class="footnote">...</aside>
inside <section> -->
<aside id="footnote"></aside>
<!-- Presentation progress bar -->
<div class="progress"><span></span></div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
theme: Reveal.getQueryHash().theme || 'default', // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/linear(2d)
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '/socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
{ src: 'plugin/ticker.js', async: true },
]
});
</script>
</body>
</html>