blockchain-lite 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{HISTORY.md → CHANGELOG.md} +3 -3
- data/Manifest.txt +1 -2
- data/README.md +310 -303
- data/Rakefile +30 -30
- data/lib/blockchain-lite/base.rb +1 -1
- data/lib/blockchain-lite/version.rb +23 -23
- data/test/helper.rb +28 -28
- data/test/test_block.rb +93 -93
- metadata +19 -16
- data/LICENSE.md +0 -116
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c23e20fae718239734cf599d73beded949a12312de4fc2535769fadaa71ca77e
|
4
|
+
data.tar.gz: 82dd5188d90c78c80f767ddb0be664d1bce6800fdebf80cd4723dec8b6440e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e04027704febb2ee957b1547343a1b0829868a2256ea74d1656f7f79895d0b6d3862be2b546793372315ba4508d766c79993bf087a9a7b65acfd16102906d6
|
7
|
+
data.tar.gz: 073a34f50dbcb36da1d1a0e20268cfe3ca96e89f5e7f27cf195f3430e3dba5b4a631d662164d5db52b7c2f66ebf90104c5567474c8d8411bf06128a31c8036c1
|
data/{HISTORY.md → CHANGELOG.md}
RENAMED
@@ -1,3 +1,3 @@
|
|
1
|
-
### 0.0.1 / 2017-09-16
|
2
|
-
|
3
|
-
* Everything is new. First release
|
1
|
+
### 0.0.1 / 2017-09-16
|
2
|
+
|
3
|
+
* Everything is new. First release
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,303 +1,310 @@
|
|
1
|
-
# Blockchain Lite
|
2
|
-
|
3
|
-
blockchain-lite library / gem - build your own blockchain with crypto hashes - revolutionize the world with blockchains, blockchains, blockchains one block at a time
|
4
|
-
|
5
|
-
* home :: [github.com/
|
6
|
-
* bugs :: [github.com/
|
7
|
-
* gem :: [rubygems.org/gems/blockchain-lite](https://rubygems.org/gems/blockchain-lite)
|
8
|
-
* rdoc :: [rubydoc.info/gems/blockchain-lite](http://rubydoc.info/gems/blockchain-lite)
|
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
|
-
attr_reader :
|
87
|
-
attr_reader :
|
88
|
-
attr_reader :
|
89
|
-
attr_reader :
|
90
|
-
attr_reader :
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@
|
95
|
-
@
|
96
|
-
@
|
97
|
-
@
|
98
|
-
@
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
sha
|
104
|
-
|
105
|
-
@
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
attr_reader :
|
122
|
-
attr_reader :
|
123
|
-
attr_reader :
|
124
|
-
attr_reader :
|
125
|
-
attr_reader :
|
126
|
-
attr_reader :
|
127
|
-
attr_reader :hash
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
@
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
@
|
136
|
-
@
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
sha
|
142
|
-
|
143
|
-
@
|
144
|
-
@
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
b << 'Transaction Data...'
|
165
|
-
b << 'Transaction Data...'
|
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
|
-
on the
|
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
|
-
{ from: "
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
{ from: "
|
235
|
-
{ from: "
|
236
|
-
{ from: "
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
{ from: "
|
241
|
-
{ from: "
|
242
|
-
{ from: "
|
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
|
-
{:from=>"
|
268
|
-
{:from=>"
|
269
|
-
|
270
|
-
|
271
|
-
@
|
272
|
-
@
|
273
|
-
@
|
274
|
-
@
|
275
|
-
@
|
276
|
-
|
277
|
-
|
278
|
-
{:from=>"
|
279
|
-
{:from=>"
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
- [**
|
288
|
-
- [**
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
1
|
+
# Blockchain Lite
|
2
|
+
|
3
|
+
blockchain-lite library / gem - build your own blockchain with crypto hashes - revolutionize the world with blockchains, blockchains, blockchains one block at a time
|
4
|
+
|
5
|
+
* home :: [github.com/rubycoco/blockchain](https://github.com/rubycoco/blockchain)
|
6
|
+
* bugs :: [github.com/rubycoco/blockchain/issues](https://github.com/rubycoco/blockchain/issues)
|
7
|
+
* gem :: [rubygems.org/gems/blockchain-lite](https://rubygems.org/gems/blockchain-lite)
|
8
|
+
* rdoc :: [rubydoc.info/gems/blockchain-lite](http://rubydoc.info/gems/blockchain-lite)
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
## What's a Blockchain?
|
13
|
+
|
14
|
+
> A blockchain is a
|
15
|
+
> a list (that is, chain) of records (that is, blocks)
|
16
|
+
> linked and secured by digital fingerprints
|
17
|
+
> (that is, crypto hashes).
|
18
|
+
|
19
|
+
See the [Awesome Blockchains](https://github.com/openblockchains/awesome-blockchains) page for more.
|
20
|
+
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Let's get started. Build your own blockchain one block at a time.
|
25
|
+
Example:
|
26
|
+
|
27
|
+
``` ruby
|
28
|
+
require 'blockchain-lite'
|
29
|
+
|
30
|
+
b0 = Block.first( 'Genesis' )
|
31
|
+
b1 = Block.next( b0, 'Transaction Data...' )
|
32
|
+
b2 = Block.next( b1, 'Transaction Data...' )
|
33
|
+
b3 = Block.next( b2, 'Transaction Data...' )
|
34
|
+
|
35
|
+
blockchain = [b0, b1, b2, b3]
|
36
|
+
|
37
|
+
pp blockchain
|
38
|
+
```
|
39
|
+
|
40
|
+
will pretty print (pp) something like:
|
41
|
+
|
42
|
+
```
|
43
|
+
[#<Block:0x1eed2a0
|
44
|
+
@index = 0,
|
45
|
+
@timestamp = 2021-09-15 20:52:38,
|
46
|
+
@transactions_count = 1,
|
47
|
+
@transactions = ["Genesis"],
|
48
|
+
@previous_hash = "0",
|
49
|
+
@hash = "edbd4e11e69bc399a9ccd8faaea44fb27410fe8e3023bb9462450a0a9c4caa1b">,
|
50
|
+
#<Block:0x1eec9a0
|
51
|
+
@index = 1,
|
52
|
+
@timestamp = 2021-09-15 21:02:38,
|
53
|
+
@transactions_count = 1,
|
54
|
+
@transactions = ["Transaction Data..."],
|
55
|
+
@hash = "eb8ecbf6d5870763ae246e37539d82e37052cb32f88bb8c59971f9978e437743",
|
56
|
+
@previous_hash = "edbd4e11e69bc399a9ccd8faaea44fb27410fe8e3023bb9462450a0a9c4caa1b">,
|
57
|
+
#<Block:0x1eec838
|
58
|
+
@index = 2,
|
59
|
+
@timestamp = 2021-09-15 21:12:38,
|
60
|
+
@transactions_count = 1,
|
61
|
+
@transactions = ["Transaction Data..."],
|
62
|
+
@hash = "be50017ee4bbcb33844b3dc2b7c4e476d46569b5df5762d14ceba9355f0a85f4",
|
63
|
+
@previous_hash = "eb8ecbf6d5870763ae246e37539d82e37052cb32f88bb8c59971f9978e437743">,
|
64
|
+
#<Block:0x1eec6d0
|
65
|
+
@index = 3,
|
66
|
+
@timestamp = 2021-09-15 21:22:38
|
67
|
+
@transactions_count = 1,
|
68
|
+
@transactions = ["Transaction Data..."],
|
69
|
+
@hash = "5ee2981606328abfe0c3b1171440f0df746c1e1f8b3b56c351727f7da7ae5d8d",
|
70
|
+
@previous_hash = "be50017ee4bbcb33844b3dc2b7c4e476d46569b5df5762d14ceba9355f0a85f4">]
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
### Blocks
|
75
|
+
|
76
|
+
[Basic](#basic) •
|
77
|
+
[Proof-of-Work](#proof-of-work)
|
78
|
+
|
79
|
+
Supported block types / classes for now include:
|
80
|
+
|
81
|
+
#### Basic
|
82
|
+
|
83
|
+
``` ruby
|
84
|
+
class Block
|
85
|
+
|
86
|
+
attr_reader :index
|
87
|
+
attr_reader :timestamp
|
88
|
+
attr_reader :transactions_count
|
89
|
+
attr_reader :transactions
|
90
|
+
attr_reader :previous_hash
|
91
|
+
attr_reader :hash
|
92
|
+
|
93
|
+
def initialize(index, transactions, previous_hash)
|
94
|
+
@index = index
|
95
|
+
@timestamp = Time.now.utc ## note: use coordinated universal time (utc)
|
96
|
+
@transactions = transactions
|
97
|
+
@transactions_count = transactions.size
|
98
|
+
@previous_hash = previous_hash
|
99
|
+
@hash = calc_hash
|
100
|
+
end
|
101
|
+
|
102
|
+
def calc_hash
|
103
|
+
sha = Digest::SHA256.new
|
104
|
+
sha.update( @timestamp.to_s +
|
105
|
+
@transactions.to_s +
|
106
|
+
@previous_hash )
|
107
|
+
sha.hexdigest
|
108
|
+
end
|
109
|
+
...
|
110
|
+
end
|
111
|
+
```
|
112
|
+
|
113
|
+
(Source: [basic/block.rb](lib/blockchain-lite/basic/block.rb))
|
114
|
+
|
115
|
+
|
116
|
+
#### Proof-of-Work
|
117
|
+
|
118
|
+
``` ruby
|
119
|
+
class Block
|
120
|
+
|
121
|
+
attr_reader :index
|
122
|
+
attr_reader :timestamp
|
123
|
+
attr_reader :transactions_count
|
124
|
+
attr_reader :transactions
|
125
|
+
attr_reader :transactions_hash ## merkle_root
|
126
|
+
attr_reader :previous_hash
|
127
|
+
attr_reader :nonce ## proof of work if hash starts with leading zeros (00)
|
128
|
+
attr_reader :hash
|
129
|
+
|
130
|
+
def initialize(index, transactions, previous_hash)
|
131
|
+
@index = index
|
132
|
+
@timestamp = Time.now.utc ## note: use coordinated universal time (utc)
|
133
|
+
@transactions = transactions
|
134
|
+
@transactions_count = transactions.size
|
135
|
+
@transactions_hash = MerkleTree.compute_root_for( transactions )
|
136
|
+
@previous_hash = previous_hash
|
137
|
+
@nonce, @hash = compute_hash_with_proof_of_work
|
138
|
+
end
|
139
|
+
|
140
|
+
def calc_hash
|
141
|
+
sha = Digest::SHA256.new
|
142
|
+
sha.update( @nonce.to_s +
|
143
|
+
@timestamp.to_s +
|
144
|
+
@transactions_hash +
|
145
|
+
@previous_hash )
|
146
|
+
sha.hexdigest
|
147
|
+
end
|
148
|
+
...
|
149
|
+
end
|
150
|
+
```
|
151
|
+
|
152
|
+
(Source: [proof_of_work/block.rb](lib/blockchain-lite/proof_of_work/block.rb))
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
### Blockchain Helper / Convenience Wrapper
|
157
|
+
|
158
|
+
The `Blockchain` class offers some convenience helpers
|
159
|
+
for building and checking blockchains. Example:
|
160
|
+
|
161
|
+
``` ruby
|
162
|
+
b = Blockchain.new # note: will (auto-) add the first (genesis) block
|
163
|
+
|
164
|
+
b << 'Transaction Data...'
|
165
|
+
b << 'Transaction Data...'
|
166
|
+
b << 'Transaction Data...'
|
167
|
+
|
168
|
+
pp b
|
169
|
+
```
|
170
|
+
|
171
|
+
Check for broken chain links. Example:
|
172
|
+
|
173
|
+
``` ruby
|
174
|
+
|
175
|
+
b.broken?
|
176
|
+
# => false ## blockchain OK
|
177
|
+
```
|
178
|
+
|
179
|
+
or use the `Blockchain` class as a wrapper (pass in the blockchain array):
|
180
|
+
|
181
|
+
``` ruby
|
182
|
+
b0 = Block.first( 'Genesis' )
|
183
|
+
b1 = Block.next( b0, 'Transaction Data...' )
|
184
|
+
b2 = Block.next( b1, 'Transaction Data...' )
|
185
|
+
b3 = Block.next( b2, 'Transaction Data...' )
|
186
|
+
|
187
|
+
blockchain = [b0, b1, b2, b3]
|
188
|
+
|
189
|
+
|
190
|
+
b = Blockchain.new( blockchain )
|
191
|
+
|
192
|
+
b.broken?
|
193
|
+
# => false ## blockchain OK
|
194
|
+
```
|
195
|
+
|
196
|
+
and so on.
|
197
|
+
|
198
|
+
|
199
|
+
### Transactions
|
200
|
+
|
201
|
+
Let's put the transactions from the (hyper) ledger book from [Tulips on the Blockchain!](https://github.com/openblockchains/tulips)
|
202
|
+
on the blockchain:
|
203
|
+
|
204
|
+
|
205
|
+
| From | To | What | Qty |
|
206
|
+
|---------------------|--------------|---------------------------|----:|
|
207
|
+
| Dutchgrown (†) | Vincent | Tulip Bloemendaal Sunset | 10 |
|
208
|
+
| Keukenhof (†) | Anne | Tulip Semper Augustus | 7 |
|
209
|
+
| | | | |
|
210
|
+
| Flowers (†) | Ruben | Tulip Admiral van Eijck | 5 |
|
211
|
+
| Vicent | Anne | Tulip Bloemendaal Sunset | 3 |
|
212
|
+
| Anne | Julia | Tulip Semper Augustus | 1 |
|
213
|
+
| Julia | Luuk | Tulip Semper Augustus | 1 |
|
214
|
+
| | | | |
|
215
|
+
| Bloom & Blossom (†) | Daisy | Tulip Admiral of Admirals | 8 |
|
216
|
+
| Vincent | Max | Tulip Bloemendaal Sunset | 2 |
|
217
|
+
| Anne | Martijn | Tulip Semper Augustus | 2 |
|
218
|
+
| Ruben | Julia | Tulip Admiral van Eijck | 2 |
|
219
|
+
| | | | |
|
220
|
+
| Teleflora (†) | Max | Tulip Red Impression | 11 |
|
221
|
+
| Anne | Naomi | Tulip Bloemendaal Sunset | 1 |
|
222
|
+
| Daisy | Vincent | Tulip Admiral of Admirals | 3 |
|
223
|
+
| Julia | Mina | Tulip Admiral van Eijck | 1 |
|
224
|
+
|
225
|
+
(†): Grower Transaction - New Tulips on the Market!
|
226
|
+
|
227
|
+
|
228
|
+
```ruby
|
229
|
+
b0 = Block.first(
|
230
|
+
{ from: "Dutchgrown", to: "Vincent", what: "Tulip Bloemendaal Sunset", qty: 10 },
|
231
|
+
{ from: "Keukenhof", to: "Anne", what: "Tulip Semper Augustus", qty: 7 } )
|
232
|
+
|
233
|
+
b1 = Block.next( b0,
|
234
|
+
{ from: "Flowers", to: "Ruben", what: "Tulip Admiral van Eijck", qty: 5 },
|
235
|
+
{ from: "Vicent", to: "Anne", what: "Tulip Bloemendaal Sunset", qty: 3 },
|
236
|
+
{ from: "Anne", to: "Julia", what: "Tulip Semper Augustus", qty: 1 },
|
237
|
+
{ from: "Julia", to: "Luuk", what: "Tulip Semper Augustus", qty: 1 } )
|
238
|
+
|
239
|
+
b2 = Block.next( b1,
|
240
|
+
{ from: "Bloom & Blossom", to: "Daisy", what: "Tulip Admiral of Admirals", qty: 8 },
|
241
|
+
{ from: "Vincent", to: "Max", what: "Tulip Bloemendaal Sunset", qty: 2 },
|
242
|
+
{ from: "Anne", to: "Martijn", what: "Tulip Semper Augustus", qty: 2 },
|
243
|
+
{ from: "Ruben", to: "Julia", what: "Tulip Admiral van Eijck", qty: 2 } )
|
244
|
+
...
|
245
|
+
```
|
246
|
+
|
247
|
+
resulting in:
|
248
|
+
|
249
|
+
```
|
250
|
+
[#<Block:0x2da3da0
|
251
|
+
@index = 0,
|
252
|
+
@timestamp = 1637-09-24 11:40:15,
|
253
|
+
@previous_hash = "0",
|
254
|
+
@hash = "32bd169baebba0b70491b748329ab631c85175be15e1672f924ca174f628cb66",
|
255
|
+
@transactions_count = 2,
|
256
|
+
@transactions =
|
257
|
+
[{:from=>"Dutchgrown", :to=>"Vincent", :what=>"Tulip Bloemendaal Sunset", :qty=>10},
|
258
|
+
{:from=>"Keukenhof", :to=>"Anne", :what=>"Tulip Semper Augustus", :qty=>7}]>,
|
259
|
+
#<Block:0x2da2ff0
|
260
|
+
@index = 1,
|
261
|
+
@timestamp = 1637-09-24 11:50:15,
|
262
|
+
@previous_hash = "32bd169baebba0b70491b748329ab631c85175be15e1672f924ca174f628cb66",
|
263
|
+
@hash = "57b519a8903e45348ac8a739c788815e2bd90423663957f87e276307f77f1028",
|
264
|
+
@transactions_count = 4,
|
265
|
+
@transactions =
|
266
|
+
[{:from=>"Flowers", :to=>"Ruben", :what=>"Tulip Admiral van Eijck", :qty=>5},
|
267
|
+
{:from=>"Vicent", :to=>"Anne", :what=>"Tulip Bloemendaal Sunset", :qty=>3},
|
268
|
+
{:from=>"Anne", :to=>"Julia", :what=>"Tulip Semper Augustus", :qty=>1},
|
269
|
+
{:from=>"Julia", :to=>"Luuk", :what=>"Tulip Semper Augustus", :qty=>1}]>,
|
270
|
+
#<Block:0x2da2720
|
271
|
+
@index = 2,
|
272
|
+
@timestamp = 1637-09-24 12:00:15,
|
273
|
+
@previous_hash = "57b519a8903e45348ac8a739c788815e2bd90423663957f87e276307f77f1028",
|
274
|
+
@hash = "ec7dd5ea86ab966d4d4db182abb7aa93c7e5f63857476e6301e7e38cebf36568",
|
275
|
+
@transactions_count = 4,
|
276
|
+
@transactions =
|
277
|
+
[{:from=>"Bloom & Blossom", :to=>"Daisy", :what=>"Tulip Admiral of Admirals", :qty=>8},
|
278
|
+
{:from=>"Vincent", :to=>"Max", :what=>"Tulip Bloemendaal Sunset", :qty=>2},
|
279
|
+
{:from=>"Anne", :to=>"Martijn", :what=>"Tulip Semper Augustus", :qty=>2},
|
280
|
+
{:from=>"Ruben", :to=>"Julia", :what=>"Tulip Admiral van Eijck", :qty=>2}]>,
|
281
|
+
...
|
282
|
+
```
|
283
|
+
|
284
|
+
|
285
|
+
## Blockchain Lite in the Real World
|
286
|
+
|
287
|
+
- [**centralbank**](../centralbank) - command line tool (and core library) - print your own money / cryptocurrency; run your own federated central bank nodes on the blockchain peer-to-peer over HTTP; revolutionize the world one block at a time
|
288
|
+
- [**tulipmania**](../tulipmania) - command line tool (and core library) - tulips on the blockchain; learn by example from the real world (anno 1637) - buy! sell! hodl! enjoy the beauty of admiral of admirals, semper augustus, and more; run your own hyper ledger tulip exchange nodes on the blockchain peer-to-peer over HTTP; revolutionize the world one block at a time
|
289
|
+
|
290
|
+
<!--
|
291
|
+
- [**shilling**](https://github.com/bitshilling/bitshilling) - command line tool (and core library) - shilling (or schilling) on the blockchain! rock-solid alpine dollar from austria; print (mine) your own shillings; run your own federated shilling central bank nodes w/ public distributed (hyper) ledger book on the blockchain peer-to-peer over HTTP; revolutionize the world one block at a time
|
292
|
+
-->
|
293
|
+
|
294
|
+
- You? Add your tool / service
|
295
|
+
|
296
|
+
|
297
|
+
## References
|
298
|
+
|
299
|
+
[**Programming Cryptocurrencies and Blockchains (in Ruby)**](http://yukimotopress.github.io/blockchains) by Gerald Bauer et al, 2018, Yuki & Moto Press
|
300
|
+
|
301
|
+
And many more @ [**Best of Crypto Books**](https://openblockchains.github.io/crypto-books/) - a collection of books, white papers & more about crypto and blockchains
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
## License
|
306
|
+
|
307
|
+
![](https://publicdomainworks.github.io/buttons/zero88x31.png)
|
308
|
+
|
309
|
+
The `blockchain.lite` scripts are dedicated to the public domain.
|
310
|
+
Use it as you please with no restrictions whatsoever.
|
data/Rakefile
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
require 'hoe'
|
2
|
-
require './lib/blockchain-lite/version.rb'
|
3
|
-
|
4
|
-
Hoe.spec 'blockchain-lite' do
|
5
|
-
|
6
|
-
self.version = BlockchainLite::VERSION
|
7
|
-
|
8
|
-
self.summary = "blockchain-lite - build your own blockchain with crypto hashes - revolutionize the world with blockchains, blockchains, blockchains one block at a time"
|
9
|
-
self.description = summary
|
10
|
-
|
11
|
-
self.urls =
|
12
|
-
|
13
|
-
self.author = 'Gerald Bauer'
|
14
|
-
self.email = 'wwwmake@googlegroups.com'
|
15
|
-
|
16
|
-
# switch extension to .markdown for gihub formatting
|
17
|
-
self.readme_file = 'README.md'
|
18
|
-
self.history_file = '
|
19
|
-
|
20
|
-
self.extra_deps = [
|
21
|
-
['merkletree'],
|
22
|
-
]
|
23
|
-
|
24
|
-
self.licenses = ['Public Domain']
|
25
|
-
|
26
|
-
self.spec_extras = {
|
27
|
-
required_ruby_version: '>= 2.3'
|
28
|
-
}
|
29
|
-
|
30
|
-
end
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/blockchain-lite/version.rb'
|
3
|
+
|
4
|
+
Hoe.spec 'blockchain-lite' do
|
5
|
+
|
6
|
+
self.version = BlockchainLite::VERSION
|
7
|
+
|
8
|
+
self.summary = "blockchain-lite - build your own blockchain with crypto hashes - revolutionize the world with blockchains, blockchains, blockchains one block at a time"
|
9
|
+
self.description = summary
|
10
|
+
|
11
|
+
self.urls = { home: 'https://github.com/rubycoco/blockchain' }
|
12
|
+
|
13
|
+
self.author = 'Gerald Bauer'
|
14
|
+
self.email = 'wwwmake@googlegroups.com'
|
15
|
+
|
16
|
+
# switch extension to .markdown for gihub formatting
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'CHANGELOG.md'
|
19
|
+
|
20
|
+
self.extra_deps = [
|
21
|
+
['merkletree'],
|
22
|
+
]
|
23
|
+
|
24
|
+
self.licenses = ['Public Domain']
|
25
|
+
|
26
|
+
self.spec_extras = {
|
27
|
+
required_ruby_version: '>= 2.3'
|
28
|
+
}
|
29
|
+
|
30
|
+
end
|
data/lib/blockchain-lite/base.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
|
4
|
-
module BlockchainLite
|
5
|
-
|
6
|
-
MAJOR = 1
|
7
|
-
MINOR = 4
|
8
|
-
PATCH =
|
9
|
-
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
10
|
-
|
11
|
-
def self.version
|
12
|
-
VERSION
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.banner
|
16
|
-
"blockchain-lite/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.root
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end # module BlockchainLite
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
|
4
|
+
module BlockchainLite
|
5
|
+
|
6
|
+
MAJOR = 1
|
7
|
+
MINOR = 4
|
8
|
+
PATCH = 1
|
9
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
10
|
+
|
11
|
+
def self.version
|
12
|
+
VERSION
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.banner
|
16
|
+
"blockchain-lite/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.root
|
20
|
+
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
|
21
|
+
end
|
22
|
+
|
23
|
+
end # module BlockchainLite
|
data/test/helper.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
## $:.unshift(File.dirname(__FILE__))
|
2
|
-
|
3
|
-
## minitest setup
|
4
|
-
|
5
|
-
require 'minitest/autorun'
|
6
|
-
|
7
|
-
|
8
|
-
## our own code
|
9
|
-
|
10
|
-
require 'blockchain-lite/base' ## note: use "modular" version without "top-level" Block constant
|
11
|
-
|
12
|
-
|
13
|
-
module Basic
|
14
|
-
Block = BlockchainLite::Basic::Block ## convenience shortcut
|
15
|
-
|
16
|
-
class Blockchain < BlockchainLite::Blockchain
|
17
|
-
def block_class() Block; end
|
18
|
-
end
|
19
|
-
end # module Basic
|
20
|
-
|
21
|
-
|
22
|
-
module ProofOfWork
|
23
|
-
Block = BlockchainLite::ProofOfWork::Block ## convenience shortcut
|
24
|
-
|
25
|
-
class Blockchain < BlockchainLite::Blockchain
|
26
|
-
def block_class() Block; end
|
27
|
-
end
|
28
|
-
end # module ProofOfWork
|
1
|
+
## $:.unshift(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
## minitest setup
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
|
7
|
+
|
8
|
+
## our own code
|
9
|
+
|
10
|
+
require 'blockchain-lite/base' ## note: use "modular" version without "top-level" Block constant
|
11
|
+
|
12
|
+
|
13
|
+
module Basic
|
14
|
+
Block = BlockchainLite::Basic::Block ## convenience shortcut
|
15
|
+
|
16
|
+
class Blockchain < BlockchainLite::Blockchain
|
17
|
+
def block_class() Block; end
|
18
|
+
end
|
19
|
+
end # module Basic
|
20
|
+
|
21
|
+
|
22
|
+
module ProofOfWork
|
23
|
+
Block = BlockchainLite::ProofOfWork::Block ## convenience shortcut
|
24
|
+
|
25
|
+
class Blockchain < BlockchainLite::Blockchain
|
26
|
+
def block_class() Block; end
|
27
|
+
end
|
28
|
+
end # module ProofOfWork
|
data/test/test_block.rb
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
###
|
4
|
-
# to run use
|
5
|
-
# ruby -I ./lib -I ./test test/test_block.rb
|
6
|
-
|
7
|
-
|
8
|
-
require 'helper'
|
9
|
-
|
10
|
-
|
11
|
-
class TestBlock < MiniTest::Test
|
12
|
-
|
13
|
-
include ProofOfWork ## adds Block = BlockchainLite::ProofOfWork::Block etc.
|
14
|
-
|
15
|
-
|
16
|
-
def test_example
|
17
|
-
|
18
|
-
b0 = Block.first( 'Genesis' )
|
19
|
-
b1 = Block.next( b0, 'Transaction Data...' )
|
20
|
-
b2 = Block.next( b1, 'Transaction Data...', 'Transaction Data...' )
|
21
|
-
b3 = Block.next( b2 ) ## no transaction data
|
22
|
-
b4 = Block.next( b3, ['Transaction Data...', 'Transaction Data...'] )
|
23
|
-
|
24
|
-
blockchain = [b0, b1, b2, b3, b4]
|
25
|
-
|
26
|
-
pp blockchain
|
27
|
-
|
28
|
-
assert true ## (for now) everything ok if we get here
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_tulips_example
|
32
|
-
b0 = Block.first(
|
33
|
-
{ from: "Dutchgrown", to: "Vincent", name: "Tulip Bloemendaal Sunset", qty: 10 },
|
34
|
-
{ from: "Keukenhof", to: "Anne", name: "Tulip Semper Augustus", qty: 7 } )
|
35
|
-
|
36
|
-
b1 = Block.next( b0,
|
37
|
-
{ from: "Flowers", to: "Ruben", name: "Tulip Admiral van Eijck", qty: 5 },
|
38
|
-
{ from: "Vicent", to: "Anne", name: "Tulip Bloemendaal Sunset", qty: 3 },
|
39
|
-
{ from: "Anne", to: "Julia", name: "Tulip Semper Augustus", qty: 1 },
|
40
|
-
{ from: "Julia", to: "Luuk", name: "Tulip Semper Augustus", qty: 1 } )
|
41
|
-
|
42
|
-
b2 = Block.next( b1,
|
43
|
-
{ from: "Bloom & Blossom", to: "Daisy", name: "Tulip Admiral of Admirals", qty: 8 },
|
44
|
-
{ from: "Vincent", to: "Max", name: "Tulip Bloemendaal Sunset", qty: 2 },
|
45
|
-
{ from: "Anne", to: "Martijn", name: "Tulip Semper Augustus", qty: 2 },
|
46
|
-
{ from: "Ruben", to: "Julia", name: "Tulip Admiral van Eijck", qty: 2 } )
|
47
|
-
|
48
|
-
blockchain = [b0, b1, b2]
|
49
|
-
|
50
|
-
pp blockchain
|
51
|
-
|
52
|
-
assert true ## (for now) everything ok if we get here
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
def timestamp1637
|
57
|
-
## change year to 1637 :-)
|
58
|
-
## note: time (uses signed integer e.g. epoch/unix time starting in 1970 with 0)
|
59
|
-
## todo: add nano/mili-seconds - why? why not? possible?
|
60
|
-
now = Time.now.utc.to_datetime
|
61
|
-
past = DateTime.new( 1637, now.month, now.mday, now.hour, now.min, now.sec, now.zone )
|
62
|
-
past
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_tulips_1637_example
|
66
|
-
|
67
|
-
b0 = Block.first(
|
68
|
-
{ from: "Dutchgrown", to: "Vincent", name: "Tulip Bloemendaal Sunset", qty: 10 },
|
69
|
-
{ from: "Keukenhof", to: "Anne", name: "Tulip Semper Augustus", qty: 7 },
|
70
|
-
timestamp: timestamp1637 )
|
71
|
-
|
72
|
-
b1 = Block.next( b0,
|
73
|
-
{ from: "Flowers", to: "Ruben", name: "Tulip Admiral van Eijck", qty: 5 },
|
74
|
-
{ from: "Vicent", to: "Anne", name: "Tulip Bloemendaal Sunset", qty: 3 },
|
75
|
-
{ from: "Anne", to: "Julia", name: "Tulip Semper Augustus", qty: 1 },
|
76
|
-
{ from: "Julia", to: "Luuk", name: "Tulip Semper Augustus", qty: 1 },
|
77
|
-
timestamp: timestamp1637 )
|
78
|
-
|
79
|
-
b2 = Block.next( b1,
|
80
|
-
{ from: "Bloom & Blossom", to: "Daisy", name: "Tulip Admiral of Admirals", qty: 8 },
|
81
|
-
{ from: "Vincent", to: "Max", name: "Tulip Bloemendaal Sunset", qty: 2 },
|
82
|
-
{ from: "Anne", to: "Martijn", name: "Tulip Semper Augustus", qty: 2 },
|
83
|
-
{ from: "Ruben", to: "Julia", name: "Tulip Admiral van Eijck", qty: 2 },
|
84
|
-
timestamp: timestamp1637 )
|
85
|
-
|
86
|
-
blockchain = [b0, b1, b2]
|
87
|
-
|
88
|
-
pp blockchain
|
89
|
-
|
90
|
-
assert true ## (for now) everything ok if we get here
|
91
|
-
end
|
92
|
-
|
93
|
-
end # class TestBlock
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
###
|
4
|
+
# to run use
|
5
|
+
# ruby -I ./lib -I ./test test/test_block.rb
|
6
|
+
|
7
|
+
|
8
|
+
require 'helper'
|
9
|
+
|
10
|
+
|
11
|
+
class TestBlock < MiniTest::Test
|
12
|
+
|
13
|
+
include ProofOfWork ## adds Block = BlockchainLite::ProofOfWork::Block etc.
|
14
|
+
|
15
|
+
|
16
|
+
def test_example
|
17
|
+
|
18
|
+
b0 = Block.first( 'Genesis' )
|
19
|
+
b1 = Block.next( b0, 'Transaction Data...' )
|
20
|
+
b2 = Block.next( b1, 'Transaction Data...', 'Transaction Data...' )
|
21
|
+
b3 = Block.next( b2 ) ## no transaction data
|
22
|
+
b4 = Block.next( b3, ['Transaction Data...', 'Transaction Data...'] )
|
23
|
+
|
24
|
+
blockchain = [b0, b1, b2, b3, b4]
|
25
|
+
|
26
|
+
pp blockchain
|
27
|
+
|
28
|
+
assert true ## (for now) everything ok if we get here
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_tulips_example
|
32
|
+
b0 = Block.first(
|
33
|
+
{ from: "Dutchgrown", to: "Vincent", name: "Tulip Bloemendaal Sunset", qty: 10 },
|
34
|
+
{ from: "Keukenhof", to: "Anne", name: "Tulip Semper Augustus", qty: 7 } )
|
35
|
+
|
36
|
+
b1 = Block.next( b0,
|
37
|
+
{ from: "Flowers", to: "Ruben", name: "Tulip Admiral van Eijck", qty: 5 },
|
38
|
+
{ from: "Vicent", to: "Anne", name: "Tulip Bloemendaal Sunset", qty: 3 },
|
39
|
+
{ from: "Anne", to: "Julia", name: "Tulip Semper Augustus", qty: 1 },
|
40
|
+
{ from: "Julia", to: "Luuk", name: "Tulip Semper Augustus", qty: 1 } )
|
41
|
+
|
42
|
+
b2 = Block.next( b1,
|
43
|
+
{ from: "Bloom & Blossom", to: "Daisy", name: "Tulip Admiral of Admirals", qty: 8 },
|
44
|
+
{ from: "Vincent", to: "Max", name: "Tulip Bloemendaal Sunset", qty: 2 },
|
45
|
+
{ from: "Anne", to: "Martijn", name: "Tulip Semper Augustus", qty: 2 },
|
46
|
+
{ from: "Ruben", to: "Julia", name: "Tulip Admiral van Eijck", qty: 2 } )
|
47
|
+
|
48
|
+
blockchain = [b0, b1, b2]
|
49
|
+
|
50
|
+
pp blockchain
|
51
|
+
|
52
|
+
assert true ## (for now) everything ok if we get here
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def timestamp1637
|
57
|
+
## change year to 1637 :-)
|
58
|
+
## note: time (uses signed integer e.g. epoch/unix time starting in 1970 with 0)
|
59
|
+
## todo: add nano/mili-seconds - why? why not? possible?
|
60
|
+
now = Time.now.utc.to_datetime
|
61
|
+
past = DateTime.new( 1637, now.month, now.mday, now.hour, now.min, now.sec, now.zone )
|
62
|
+
past
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_tulips_1637_example
|
66
|
+
|
67
|
+
b0 = Block.first(
|
68
|
+
{ from: "Dutchgrown", to: "Vincent", name: "Tulip Bloemendaal Sunset", qty: 10 },
|
69
|
+
{ from: "Keukenhof", to: "Anne", name: "Tulip Semper Augustus", qty: 7 },
|
70
|
+
timestamp: timestamp1637 )
|
71
|
+
|
72
|
+
b1 = Block.next( b0,
|
73
|
+
{ from: "Flowers", to: "Ruben", name: "Tulip Admiral van Eijck", qty: 5 },
|
74
|
+
{ from: "Vicent", to: "Anne", name: "Tulip Bloemendaal Sunset", qty: 3 },
|
75
|
+
{ from: "Anne", to: "Julia", name: "Tulip Semper Augustus", qty: 1 },
|
76
|
+
{ from: "Julia", to: "Luuk", name: "Tulip Semper Augustus", qty: 1 },
|
77
|
+
timestamp: timestamp1637 )
|
78
|
+
|
79
|
+
b2 = Block.next( b1,
|
80
|
+
{ from: "Bloom & Blossom", to: "Daisy", name: "Tulip Admiral of Admirals", qty: 8 },
|
81
|
+
{ from: "Vincent", to: "Max", name: "Tulip Bloemendaal Sunset", qty: 2 },
|
82
|
+
{ from: "Anne", to: "Martijn", name: "Tulip Semper Augustus", qty: 2 },
|
83
|
+
{ from: "Ruben", to: "Julia", name: "Tulip Admiral van Eijck", qty: 2 },
|
84
|
+
timestamp: timestamp1637 )
|
85
|
+
|
86
|
+
blockchain = [b0, b1, b2]
|
87
|
+
|
88
|
+
pp blockchain
|
89
|
+
|
90
|
+
assert true ## (for now) everything ok if we get here
|
91
|
+
end
|
92
|
+
|
93
|
+
end # class TestBlock
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockchain-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: merkletree
|
@@ -28,43 +28,47 @@ dependencies:
|
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.0'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '7'
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
|
-
- - "
|
41
|
+
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '4.0'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '7'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: hoe
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
53
|
+
version: '3.22'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
60
|
+
version: '3.22'
|
55
61
|
description: blockchain-lite - build your own blockchain with crypto hashes - revolutionize
|
56
62
|
the world with blockchains, blockchains, blockchains one block at a time
|
57
63
|
email: wwwmake@googlegroups.com
|
58
64
|
executables: []
|
59
65
|
extensions: []
|
60
66
|
extra_rdoc_files:
|
61
|
-
-
|
62
|
-
- LICENSE.md
|
67
|
+
- CHANGELOG.md
|
63
68
|
- Manifest.txt
|
64
69
|
- README.md
|
65
70
|
files:
|
66
|
-
-
|
67
|
-
- LICENSE.md
|
71
|
+
- CHANGELOG.md
|
68
72
|
- Manifest.txt
|
69
73
|
- README.md
|
70
74
|
- Rakefile
|
@@ -81,11 +85,11 @@ files:
|
|
81
85
|
- test/test_block_proof_of_work.rb
|
82
86
|
- test/test_blockchain.rb
|
83
87
|
- test/test_version.rb
|
84
|
-
homepage: https://github.com/
|
88
|
+
homepage: https://github.com/rubycoco/blockchain
|
85
89
|
licenses:
|
86
90
|
- Public Domain
|
87
91
|
metadata: {}
|
88
|
-
post_install_message:
|
92
|
+
post_install_message:
|
89
93
|
rdoc_options:
|
90
94
|
- "--main"
|
91
95
|
- README.md
|
@@ -102,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
106
|
- !ruby/object:Gem::Version
|
103
107
|
version: '0'
|
104
108
|
requirements: []
|
105
|
-
|
106
|
-
|
107
|
-
signing_key:
|
109
|
+
rubygems_version: 3.1.4
|
110
|
+
signing_key:
|
108
111
|
specification_version: 4
|
109
112
|
summary: blockchain-lite - build your own blockchain with crypto hashes - revolutionize
|
110
113
|
the world with blockchains, blockchains, blockchains one block at a time
|
data/LICENSE.md
DELETED
@@ -1,116 +0,0 @@
|
|
1
|
-
CC0 1.0 Universal
|
2
|
-
|
3
|
-
Statement of Purpose
|
4
|
-
|
5
|
-
The laws of most jurisdictions throughout the world automatically confer
|
6
|
-
exclusive Copyright and Related Rights (defined below) upon the creator and
|
7
|
-
subsequent owner(s) (each and all, an "owner") of an original work of
|
8
|
-
authorship and/or a database (each, a "Work").
|
9
|
-
|
10
|
-
Certain owners wish to permanently relinquish those rights to a Work for the
|
11
|
-
purpose of contributing to a commons of creative, cultural and scientific
|
12
|
-
works ("Commons") that the public can reliably and without fear of later
|
13
|
-
claims of infringement build upon, modify, incorporate in other works, reuse
|
14
|
-
and redistribute as freely as possible in any form whatsoever and for any
|
15
|
-
purposes, including without limitation commercial purposes. These owners may
|
16
|
-
contribute to the Commons to promote the ideal of a free culture and the
|
17
|
-
further production of creative, cultural and scientific works, or to gain
|
18
|
-
reputation or greater distribution for their Work in part through the use and
|
19
|
-
efforts of others.
|
20
|
-
|
21
|
-
For these and/or other purposes and motivations, and without any expectation
|
22
|
-
of additional consideration or compensation, the person associating CC0 with a
|
23
|
-
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
24
|
-
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
25
|
-
and publicly distribute the Work under its terms, with knowledge of his or her
|
26
|
-
Copyright and Related Rights in the Work and the meaning and intended legal
|
27
|
-
effect of CC0 on those rights.
|
28
|
-
|
29
|
-
1. Copyright and Related Rights. A Work made available under CC0 may be
|
30
|
-
protected by copyright and related or neighboring rights ("Copyright and
|
31
|
-
Related Rights"). Copyright and Related Rights include, but are not limited
|
32
|
-
to, the following:
|
33
|
-
|
34
|
-
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
35
|
-
and translate a Work;
|
36
|
-
|
37
|
-
ii. moral rights retained by the original author(s) and/or performer(s);
|
38
|
-
|
39
|
-
iii. publicity and privacy rights pertaining to a person's image or likeness
|
40
|
-
depicted in a Work;
|
41
|
-
|
42
|
-
iv. rights protecting against unfair competition in regards to a Work,
|
43
|
-
subject to the limitations in paragraph 4(a), below;
|
44
|
-
|
45
|
-
v. rights protecting the extraction, dissemination, use and reuse of data in
|
46
|
-
a Work;
|
47
|
-
|
48
|
-
vi. database rights (such as those arising under Directive 96/9/EC of the
|
49
|
-
European Parliament and of the Council of 11 March 1996 on the legal
|
50
|
-
protection of databases, and under any national implementation thereof,
|
51
|
-
including any amended or successor version of such directive); and
|
52
|
-
|
53
|
-
vii. other similar, equivalent or corresponding rights throughout the world
|
54
|
-
based on applicable law or treaty, and any national implementations thereof.
|
55
|
-
|
56
|
-
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
57
|
-
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
58
|
-
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
59
|
-
and Related Rights and associated claims and causes of action, whether now
|
60
|
-
known or unknown (including existing as well as future claims and causes of
|
61
|
-
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
62
|
-
duration provided by applicable law or treaty (including future time
|
63
|
-
extensions), (iii) in any current or future medium and for any number of
|
64
|
-
copies, and (iv) for any purpose whatsoever, including without limitation
|
65
|
-
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
66
|
-
the Waiver for the benefit of each member of the public at large and to the
|
67
|
-
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
68
|
-
shall not be subject to revocation, rescission, cancellation, termination, or
|
69
|
-
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
70
|
-
by the public as contemplated by Affirmer's express Statement of Purpose.
|
71
|
-
|
72
|
-
3. Public License Fallback. Should any part of the Waiver for any reason be
|
73
|
-
judged legally invalid or ineffective under applicable law, then the Waiver
|
74
|
-
shall be preserved to the maximum extent permitted taking into account
|
75
|
-
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
76
|
-
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
77
|
-
non transferable, non sublicensable, non exclusive, irrevocable and
|
78
|
-
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
79
|
-
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
80
|
-
provided by applicable law or treaty (including future time extensions), (iii)
|
81
|
-
in any current or future medium and for any number of copies, and (iv) for any
|
82
|
-
purpose whatsoever, including without limitation commercial, advertising or
|
83
|
-
promotional purposes (the "License"). The License shall be deemed effective as
|
84
|
-
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
85
|
-
License for any reason be judged legally invalid or ineffective under
|
86
|
-
applicable law, such partial invalidity or ineffectiveness shall not
|
87
|
-
invalidate the remainder of the License, and in such case Affirmer hereby
|
88
|
-
affirms that he or she will not (i) exercise any of his or her remaining
|
89
|
-
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
90
|
-
and causes of action with respect to the Work, in either case contrary to
|
91
|
-
Affirmer's express Statement of Purpose.
|
92
|
-
|
93
|
-
4. Limitations and Disclaimers.
|
94
|
-
|
95
|
-
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
96
|
-
surrendered, licensed or otherwise affected by this document.
|
97
|
-
|
98
|
-
b. Affirmer offers the Work as-is and makes no representations or warranties
|
99
|
-
of any kind concerning the Work, express, implied, statutory or otherwise,
|
100
|
-
including without limitation warranties of title, merchantability, fitness
|
101
|
-
for a particular purpose, non infringement, or the absence of latent or
|
102
|
-
other defects, accuracy, or the present or absence of errors, whether or not
|
103
|
-
discoverable, all to the greatest extent permissible under applicable law.
|
104
|
-
|
105
|
-
c. Affirmer disclaims responsibility for clearing rights of other persons
|
106
|
-
that may apply to the Work or any use thereof, including without limitation
|
107
|
-
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
108
|
-
disclaims responsibility for obtaining any necessary consents, permissions
|
109
|
-
or other rights required for any use of the Work.
|
110
|
-
|
111
|
-
d. Affirmer understands and acknowledges that Creative Commons is not a
|
112
|
-
party to this document and has no duty or obligation with respect to this
|
113
|
-
CC0 or use of the Work.
|
114
|
-
|
115
|
-
For more information, please see
|
116
|
-
<http://creativecommons.org/publicdomain/zero/1.0/>
|