zold 0.10.17 → 0.10.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f82eb3e8bbf86a83ea78315d7ecb2018ef1f6fcb
4
- data.tar.gz: 9fc982bf05be569cb2bf9d1fe821fb6fcb9d1f53
3
+ metadata.gz: 38e652467a444ab842b0541b9ffd7bb387e90325
4
+ data.tar.gz: 5386183382f20e4cb78e3b2dacd4f83ba02ef896
5
5
  SHA512:
6
- metadata.gz: 0df44ded0be61884ca4ceb84cc844bc20867abc8cc96a23ea510285ef6daabf371c1660423bcdd696ddbced6e0886318ad7b987f920703f032c8211b360c8fbe
7
- data.tar.gz: d89ea78fff3c9e9f7c8434b93b29bf6532d224509f259db03212aafbbd0440ab52fca845a27c25a4b801054954cde3826bc1a6b2c66004b6a4835b706586ee32
6
+ metadata.gz: d7eb3aa339296a9d9b21891d7dbba0eb1d8479fcbe52724bc76d189bbf262095a90bbc8939a58ca984559c3f55d3c8d5fdcfbecd1ca27d5124ca9e0126ddc476
7
+ data.tar.gz: 9affbc7d7f5c4a04a92fc7d27287d802e1dd27d543ce0f0575d78acba9779defaddac4fdf5c7601c4df179a333ee15335d4b5e70619e2c03e673c06f99aa8915
data/README.md CHANGED
@@ -1,34 +1,34 @@
1
1
  <img src="http://www.zold.io/logo.svg" width="92px" height="92px"/>
2
2
 
3
3
  [![EO principles respected here](http://www.elegantobjects.org/badge.svg)](http://www.elegantobjects.org)
4
- [![Managed by Zerocracy](https://www.0crat.com/badge/C91QJT4CF.svg)](https://www.0crat.com/p/C91QJT4CF)
5
- [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/Zold)](http://www.rultor.com/p/yegor256/Zold)
4
+ [![Managed by Zerocracy](https://www.0crat.com/badge/CAZPZR9FS.svg)](https://www.0crat.com/p/CAZPZR9FS)
5
+ [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/zold)](http://www.rultor.com/p/yegor256/zold)
6
6
  [![We recommend RubyMine](http://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
7
7
 
8
- [![Build Status](https://travis-ci.org/yegor256/zold.svg)](https://travis-ci.org/yegor256/zold)
9
- [![Build status](https://ci.appveyor.com/api/projects/status/ypctxm5ohrtp2kr4?svg=true)](https://ci.appveyor.com/project/yegor256/zold)
10
- [![PDD status](http://www.0pdd.com/svg?name=yegor256/zold)](http://www.0pdd.com/p?name=yegor256/zold)
8
+ [![Build Status](https://travis-ci.org/zold-io/zold.svg)](https://travis-ci.org/zold-io/zold)
9
+ [![Build status](https://ci.appveyor.com/api/projects/status/ypctxm5ohrtp2kr4?svg=true)](https://ci.appveyor.com/project/zold-io/zold)
10
+ [![PDD status](http://www.0pdd.com/svg?name=zold-io/zold)](http://www.0pdd.com/p?name=zold-io/zold)
11
11
  [![Gem Version](https://badge.fury.io/rb/zold.svg)](http://badge.fury.io/rb/zold)
12
- [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/zold.svg)](https://codecov.io/github/yegor256/zold?branch=master)
12
+ [![Test Coverage](https://img.shields.io/codecov/c/github/zold-io/zold.svg)](https://codecov.io/github/zold-io/zold?branch=master)
13
13
 
14
- [![Dependency Status](https://gemnasium.com/yegor256/zold.svg)](https://gemnasium.com/yegor256/zold)
15
- [![Maintainability](https://api.codeclimate.com/v1/badges/7489c1d2bacde40ffc09/maintainability)](https://codeclimate.com/github/yegor256/zold/maintainability)
14
+ [![Dependency Status](https://gemnasium.com/zold-io/zold.svg)](https://gemnasium.com/zold-io/zold)
15
+ [![Maintainability](https://api.codeclimate.com/v1/badges/7489c1d2bacde40ffc09/maintainability)](https://codeclimate.com/github/zold-io/zold/maintainability)
16
16
 
17
17
  **NOTICE**: It's an experiment and a very early draft! Please, feel free to
18
18
  submit your ideas and/or pull requests.
19
19
 
20
- Here is the [White Paper](https://github.com/yegor256/zold/raw/master/wp/wp.pdf).
20
+ Here is the [White Paper](https://github.com/zold-io/papers/raw/master/wp.pdf).
21
21
 
22
22
  Join our [Telegram group](https://t.me/zold_io) to discuss it all live.
23
23
 
24
- The license is [MIT](https://github.com/yegor256/zold/blob/master/LICENSE.txt).
24
+ The license is [MIT](https://github.com/zold-io/zold/blob/master/LICENSE.txt).
25
25
 
26
26
  ## How to Use
27
27
 
28
28
  First, install [Ruby 2.3+](https://www.ruby-lang.org/en/documentation/installation/),
29
29
  [Rubygems](https://rubygems.org/pages/download), and
30
30
  the [gem](https://rubygems.org/gems/zold).
31
- Here is [how](https://github.com/yegor256/zold/blob/master/INSTALL.md).
31
+ Here is [how](https://github.com/zold-io/zold/blob/master/INSTALL.md).
32
32
 
33
33
  To make sure it's installed, try:
34
34
 
@@ -149,7 +149,7 @@ $ bundle update
149
149
  $ rake
150
150
  ```
151
151
 
152
- The build has to be clean. If it's not, [submit an issue](https://github.com/yegor256/zold/issues).
152
+ The build has to be clean. If it's not, [submit an issue](https://github.com/zold-io/zold/issues).
153
153
 
154
154
  Then, make your changes, make sure the build is still clean,
155
155
  and [submit a pull request](https://www.yegor256.com/2014/04/15/github-guidelines.html).
@@ -50,7 +50,7 @@ Available options:"
50
50
  raise 'Receiver wallet ID is required' if mine[0].nil?
51
51
  id = Zold::Id.new(mine[0])
52
52
  wallet = @wallets.find(id)
53
- raise "Wallet #{id} doesn\'t exist in #{@wallets}, do 'fetch' first" unless wallet.exists?
53
+ raise "Wallet #{id} doesn\'t exist in #{@wallets}, do 'pull' first" unless wallet.exists?
54
54
  invoice(wallet, opts)
55
55
  end
56
56
 
@@ -72,6 +72,7 @@ Available options:"
72
72
  end
73
73
  mine = Args.new(opts, @log).take || return
74
74
  command = mine[0]
75
+ raise "A command is required, try 'zold remote --help'" unless command
75
76
  case command
76
77
  when 'show'
77
78
  show
@@ -76,6 +76,8 @@ module Zold
76
76
  Remote.new(remotes: settings.remotes, log: settings.log).run(
77
77
  ['remote', 'add', s.host, s.port.to_s, '--force']
78
78
  )
79
+ else
80
+ settings.log.debug("#{request.url}: the score is too weak: #{s}")
79
81
  end
80
82
  end
81
83
 
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.10.17'.freeze
26
+ VERSION = '0.10.18'.freeze
27
27
  end
data/zold.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.description = 'Non-blockchain cryptocurrency'
37
37
  s.authors = ['Yegor Bugayenko']
38
38
  s.email = 'yegor256@gmail.com'
39
- s.homepage = 'http://github.com/yegor256/zold'
39
+ s.homepage = 'http://github.com/zold-io/zold'
40
40
  s.files = `git ls-files`.split($RS)
41
41
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
42
42
  s.test_files = s.files.grep(%r{^(test|spec|features|wp)/})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.17
4
+ version: 0.10.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -371,14 +371,8 @@ files:
371
371
  - test/test_wallet.rb
372
372
  - test/test_wallets.rb
373
373
  - test/test_zold.rb
374
- - wp/.gitignore
375
- - wp/Makefile
376
- - wp/logo.pdf
377
- - wp/main.bib
378
- - wp/wp.pdf
379
- - wp/wp.tex
380
374
  - zold.gemspec
381
- homepage: http://github.com/yegor256/zold
375
+ homepage: http://github.com/zold-io/zold
382
376
  licenses:
383
377
  - MIT
384
378
  metadata: {}
@@ -446,9 +440,3 @@ test_files:
446
440
  - test/test_wallet.rb
447
441
  - test/test_wallets.rb
448
442
  - test/test_zold.rb
449
- - wp/.gitignore
450
- - wp/Makefile
451
- - wp/logo.pdf
452
- - wp/main.bib
453
- - wp/wp.pdf
454
- - wp/wp.tex
data/wp/.gitignore DELETED
@@ -1,8 +0,0 @@
1
- _minted-wp
2
- wp.aux
3
- wp.bcf
4
- wp.bbl
5
- wp.blg
6
- wp.log
7
- wp.out
8
- wp.run.xml
data/wp/Makefile DELETED
@@ -1,13 +0,0 @@
1
- OPTS=-shell-escape -halt-on-error -interaction=errorstopmode -output-directory=.
2
-
3
- wp.pdf: wp.tex
4
- pdflatex ${OPTS} wp.tex > /dev/null
5
- biber wp > /dev/null
6
- pdflatex ${OPTS} wp.tex > /dev/null
7
- grep 'LaTeX Warning' wp.log ; if [ $$? -eq 0 ]; then cat wp.log; exit -1; fi
8
- grep 'Overfull ' wp.log ; if [ $$? -eq 0 ]; then cat wp.log; exit -1; fi
9
- grep 'Underfull ' wp.log ; if [ $$? -eq 0 ]; then cat wp.log; exit -1; fi
10
-
11
- clean:
12
- rm -rf wp.log wp.pdf wp.out wp.aux
13
-
data/wp/logo.pdf DELETED
Binary file
data/wp/main.bib DELETED
@@ -1,99 +0,0 @@
1
- @article{nakamoto2008,
2
- title={Bitcoin: A Peer-to-peer Electronic Cash System},
3
- author={Nakamoto, Satoshi},
4
- year={2008}
5
- }
6
-
7
- @article{buterin2013,
8
- author={Vitalik Buterin},
9
- title={Ethereum: A Next-Generation Smart Contract and Decentralized Application Platform},
10
- year={2013},
11
- url={https://github.com/ethereum/wiki/wiki/White-Paper}
12
- }
13
-
14
- @article{popov2017,
15
- title={The Tangle},
16
- author={Serguei Popov},
17
- year={2017},
18
- url={https://iotatoken.com/IOTA_Whitepaper.pdf}
19
- }
20
-
21
- @inproceedings{kaskaloglu2014,
22
- title={Near Zero Bitcoin Transaction Fees Cannot Last Forever},
23
- author={Kaskaloglu, Kerem},
24
- booktitle={The International Conference on Digital Security and Forensics},
25
- pages={91--99},
26
- year={2014},
27
- organization={The Society of Digital Information and Wireless Communication}
28
- }
29
-
30
- @article{van2014,
31
- title={Why Bitcoin Has Value},
32
- author={Van Alstyne, Marshall},
33
- journal={Communications of the ACM},
34
- volume={57},
35
- number={5},
36
- pages={30--32},
37
- year={2014},
38
- publisher={ACM}
39
- }
40
-
41
- @article{andreessen2014,
42
- title={Why Bitcoin Matters},
43
- author={Andreessen, Marc},
44
- journal={New York Times},
45
- volume={21},
46
- year={2014}
47
- }
48
-
49
- @article{pilkington2016,
50
- title={Blockchain Technology: Principles and Applications},
51
- author={Pilkington, Marc},
52
- journal={Research Handbook on Digital Transformations},
53
- pages={225},
54
- year={2016},
55
- publisher={Edward Elgar Publishing}
56
- }
57
-
58
- @inproceedings{karame2012,
59
- title={Double-spending Fast Payments in Bitcoin},
60
- author={Karame, Ghassan O. and Androulaki, Elli and Capkun, Srdjan},
61
- booktitle={Proceedings of the 2012 ACM conference on Computer and communications security},
62
- pages={906--917},
63
- year={2012},
64
- organization={ACM}
65
- }
66
-
67
- @inproceedings{everaere2010,
68
- title={Double Spending Protection for E-cash Based on Risk Management},
69
- author={Everaere, Patricia and Simplot-Ryl, Isabelle and Traor{\'e}, Issa},
70
- booktitle={International Conference on Information Security},
71
- pages={394--408},
72
- year={2010},
73
- organization={Springer}
74
- }
75
-
76
- @techreport{boyen2016,
77
- title={Blockchain-free Cryptocurrencies: A Framework for Truly Decentralised Fast Transactions},
78
- author={Boyen, Xavier and Carr, Christopher and Haines, Thomas},
79
- year={2016},
80
- institution={Cryptology ePrint Archive, Report 2016/871}
81
- }
82
-
83
- @inproceedings{moser2015,
84
- title={Trends, Tips, Tolls: A Longitudinal Study of Bitcoin Transaction Fees},
85
- author={M{\"o}ser, Malte and B{\"o}hme, Rainer},
86
- booktitle={International Conference on Financial Cryptography and Data Security},
87
- pages={19--33},
88
- year={2015},
89
- organization={Springer}
90
- }
91
-
92
- @article{kiayias2015,
93
- title={Speed-Security Tradeoffs in Blockchain Protocols},
94
- author={Kiayias, Aggelos and Panagiotakos, Giorgos},
95
- journal={IACR Cryptology ePrint Archive},
96
- volume={2015},
97
- pages={1019},
98
- year={2015}
99
- }
data/wp/wp.pdf DELETED
Binary file
data/wp/wp.tex DELETED
@@ -1,731 +0,0 @@
1
- \documentclass[11pt,oneside]{article}
2
- \usepackage[utf8]{inputenc}
3
- \usepackage[american]{babel}
4
- \usepackage{bookmark}
5
- \usepackage{microtype}
6
- % \usepackage{mathpazo} % Palantino font
7
- \usepackage{mdframed}
8
- \usepackage{pgfplots}
9
- \usepackage{hyperref}
10
- \usepackage[style=authoryear,sorting=nyt,backend=biber,
11
- hyperref=true,abbreviate=true,
12
- maxcitenames=1,maxbibnames=1]{biblatex}
13
- \renewbibmacro{in:}{}
14
- \addbibresource{main.bib}
15
- \usepackage{minted}
16
- \setminted{fontsize=\small}
17
- \setminted{breaklines}
18
- \usemintedstyle{bw}
19
- \BeforeBeginEnvironment{minted}{\vspace{6pt}\begin{mdframed}[topline=false,rightline=false,bottomline=false,linecolor=black,linewidth=2pt]}
20
- \AfterEndEnvironment{minted}{\end{mdframed}}
21
- \usepackage{xcolor}
22
- \usepackage{graphicx}
23
- \pagecolor{black!3}
24
- \newcommand\dd[1]{\colorbox{gray!30}{\texttt{#1}}}
25
- \usepackage{hyperref}
26
- \hypersetup{colorlinks=true,allcolors=blue!40!black}
27
- \setlength{\topskip}{6pt}
28
- \setlength{\parindent}{0pt} % indent first line
29
- \setlength{\parskip}{6pt} % before par
30
-
31
- \title{\includegraphics[scale=0.3]{logo.pdf}\\Zold: A Fast Cryptocurrency for Micro Payments}
32
- \author{Yegor Bugayenko\\\texttt{yegor256@gmail.com}}
33
-
34
- \begin{document}
35
- \raggedbottom
36
-
37
- \maketitle
38
- \begin{abstract}
39
- In the last few years digital currencies have successfully demonstrated
40
- their ability to become an alternative financial instrument in many
41
- different markets. Most of the technologies available at the moment are
42
- based on the principles of Blockchain architecture, including
43
- dominating currencies like Bitcoin and Etherium. Despite its
44
- popularity, Blockchain is not the best possible solution for all scenarios. One such example is
45
- for fast micro-payments.
46
- Zold is an \emph{experimental} alternative that enables distributed transactions between
47
- anonymous users, making micro-payments financially feasible.
48
- It borrows the ``proof of work'' principle from Bitcoin,
49
- and suggests a different architecture for digital wallet maintenance.
50
- \end{abstract}
51
-
52
- \section{Motivation}
53
-
54
- Bitcoin, the first decentralized digital currency, was released in January 2009~\parencite{nakamoto2008}.
55
- In the following years ``a libertarian fairy tale'' and ``a simple Silicon Valley exercise in hype''
56
- turned into ``a catalyst to reshape the financial system in ways that are more
57
- powerful for individuals and businesses alike,'' according to \textcite{andreessen2014}.
58
- At the moment, as~\textcite{van2014} claimed, ``the question is not whether Bitcoin has value; it already does.
59
- The question is whether the efficiencies of a cybercurrency
60
- like Bitcoin can be merged with the certainties of an honest central bank.''
61
-
62
- The core component of Bitcoin is Blockchain technology, which
63
- ``ensures the elimination of the double-spend problem, with the help
64
- of public-key cryptography'' and ``coins are transferred by the
65
- digital signature of a hash''~\parencite{pilkington2016}.
66
- Very soon after Bitcoin was created, similar products were introduced,
67
- which were also based on the principles of Blockchain, such as
68
- Etherium~\parencite{buterin2013}.
69
-
70
- Even though Blockchain is a sound solution to the double-spending
71
- problem, there could be other solutions,
72
- including different ``proof-of'' alternatives.%
73
- \footnote{%
74
- \url{https://goo.gl/aqzf2Q}:
75
- ``Proof-of-Burn'': instead of bringing the money together into computer equipment,
76
- the owner burns the coins by sending to an address where they are
77
- irretrievable. By doing this, the owner gets a privilege to
78
- mine on the system.
79
- ``Proof-of-Stake'': the coins exist from the start, and
80
- the validators get a reward in the form of transaction fees.
81
- ``Proof-Of-Capacity'': one pays with the hard drive space. The more
82
- dedicated hard drive space, the higher probability of mining
83
- the next block and earning a reward.
84
- ``Proof-of-Elapsed-Time'': one uses a Trusted Execution Environment or TEE
85
- to ensure a random looter production.
86
- }
87
- For example, \textcite{everaere2010} gave
88
- a summary of them and introduced their own;
89
- \textcite{boyen2016} described
90
- ``a truly distributed ledger system based on a lean graph of cross-verifying transactions'';
91
- recently IOTA, a ``tangle-based cryptocurrency,'' was launched~\parencite{popov2017}.
92
-
93
- Zold is also a decentralized digital currency that maintains its ledgers
94
- through an unpredicable amount of anonymous and untrustable server nodes, trying to guarantee
95
- data consistency. The architecture of Zold is not Blockchain-based.
96
- The development of Zold was motivated by the desire to overcome
97
- two obvious disadvantages present in the majority of all existing cryptocyrrencies:
98
-
99
- The first problem is that transaction processing is rather slow.%
100
- \footnote{%
101
- \url{https://goo.gl/sWiAWc}:
102
- ``Current rates for Bitcoin processing
103
- speed is 7 transactions per second (tps) while Paypal handles
104
- an average of 115 tps and the VISA
105
- network has a peak capacity of 47,000 tps (though it currently needs 2000-4000 tps).''
106
- }
107
- \textcite{karame2012} says that ``Bitcoin requires tens of minutes to verify a transaction
108
- and is therefore inappropriate for fast payments.''
109
- It is inevitable, since
110
- ``processing speed is at odds with the security aspects of the underlying
111
- proof-of-work based consensus mechanism'' according to~\textcite{kiayias2015}.
112
-
113
- The second problem, as noted by~\textcite{popov2017}, is that ``it is not easy to get rid
114
- of fees in the blockchain infrastructure since they serve
115
- as an incentive for the creators of blocks.''
116
- As per~\textcite{moser2015}, ``Bitcoin users are encouraged to
117
- pay fees to miners, up to 10 cents (of USD) per transaction, irrespective of the
118
- amount paid'' which especially hurts when transaction amounts are smaller than a dollar.
119
- Moreover, according to~\textcite{kaskaloglu2014},
120
- ``an increase in transaction fees of Bitcoin is inevitable.''
121
-
122
- Thus, the speed is low and the processing fees are high.
123
- Zold was created as an attempt to resolve these two problems
124
- with existing Blockchain-based digital currencies.
125
-
126
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
127
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
128
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129
- \section{Principles}
130
-
131
- \textbf{No General Ledger}.
132
- Unlike \emph{all} other crypto currencies, there is no central ledger in Zold.
133
- Each wallet has its own personal ledger.
134
- All transactions in each ledger are confirmed by
135
- \href{https://en.wikipedia.org/wiki/RSA_(cryptosystem)}{RSA signatures} of their owners.
136
- Section~\ref{sec:wallets} explains how it works.
137
-
138
- \textbf{Proof of work}.
139
- Similar to many other digital currencies---including Bitcoin, Etherium, Plancoin, Monero, Trinity, Plancoin, Dero,
140
- and many others---Zold nodes find consensus by comparing the amount of CPU power invested
141
- by each of them into finding hash suffixes, performing certain expensive and meaningless calculations.
142
- Section~\ref{sec:score} describes the algorithm being used.
143
-
144
- \textbf{Root Wallet}.
145
- Zold is a pre-mined%
146
- \footnote{%
147
- \url{https://goo.gl/QBhbcT}:
148
- ``A premine or instamine is where the developer or developers don't release
149
- the crypto currency in what can be considered a fair manner.
150
- Even Bitcoin can be considered to be instamined to a certain extent.
151
- A premine is where a developer allocates a certain amount of currency
152
- credit to a particular address before releasing the source
153
- code to the open community.''
154
- }
155
- digital asset, similar to Ripple,%
156
- \footnote{%
157
- \url{https://goo.gl/XAtPH8}:
158
- ``When the Ripple network was created, 100 billion XRP was created.
159
- The founders gave 80 billion XRP to the Ripple Labs. Ripple Labs
160
- will develop the Ripple software, promote the Ripple payment system,
161
- give away XRP, and sell XRP.''
162
- }
163
- Cardano,
164
- Stellar,%
165
- \footnote{%
166
- \url{https://goo.gl/CnQQwA}:
167
- ``The stellar network started with 100 billion lumens.
168
- There is a 1\% p.a. inflation, hence the current total of roughly 103.5 billion lumens.
169
- About 18 billion lumens are on the market and the other
170
- 85 is held by the stellar development foundation.''
171
- }
172
- EOS, NEO, Loki,%
173
- \footnote{%
174
- \url{https://goo.gl/By5CR3}:
175
- ``Over 7 million Loki is held in escrow for the Founder,
176
- Advisor, and Seed allocations. The Founder and Advisor allocations
177
- follow a 12 month lockup schedule, where 25\% of each allocation is
178
- released every 90 days following mainnet launch. The allocations
179
- to Founders and Advisors are remuneration for services rendered to the
180
- LAG Foundation Ltd. The Seed allocation follows a similar schedule, with a
181
- 30\% initial release and 20\% every 90 days until the final release of 10\%.''
182
- }
183
- and many others.
184
- The only way to get ZLD is to receive it from someone else.
185
- The root wallet belongs to the issuer and may have a negative balance,
186
- which can grow according to a pre-defined restrictive formula, explained in Section~\ref{sec:formula}.
187
- All other wallets may only have positive balances.
188
-
189
- \textbf{Taxes}.
190
- Unlike many other payment systems, Zold doesn't require its users
191
- to pay transaction fees. Instead, wallets have to pay regular ``taxes'' for the
192
- service of their maintenances. Taxes amounts depend on the amount
193
- of transactions in a wallet and the age of the wallet.
194
- Section~\ref{sec:taxes} provides more details.
195
-
196
- \textbf{No Trust}.
197
- The network of communicating nodes maintains wallets of users.
198
- Anyone can add a node to the network.
199
- It is assumed that any node may contain corrupted data, either by mistake or intentionally.
200
- Section~\ref{sec:remotes} explains how nodes communicate and rate each other.
201
-
202
- \textbf{Open Source}.
203
- Zold is a command line tool. Its entire code base is open
204
- and hosted at the GitHub \href{https://github.com/yegor256/zold}{yegor256/zold}
205
- repository.
206
-
207
- \textbf{Capacity}.
208
- One currency unit is called ZLD.
209
- One ZLD by convention equals to $2^{32}$ \emph{zents} (4,294,967,296).
210
- All amounts are stored as signed 64-bit integers.
211
- Thus, the technical capacity of the currency is 2,147,483,648 ZLD (two billion).%
212
- \footnote{%
213
- To compare, the total supply of some crypto currencies is:
214
- Bitcoin: 21m BTC,
215
- Ethereum;: 100m ETH,
216
- Ripple: 100b XRP,
217
- Litecoin: 84m LTC,
218
- Cardano: 31b ADA,
219
- Stellar: 103b XLM,
220
- NEO: 100m NEO,
221
- Dash: 19m DASH.
222
- }
223
-
224
- \textbf{Hexspeak}.
225
- Wallet ID is a 16-digit hexadecimal number, which is not restricted by any formula.
226
- A user may make up any number, even using
227
- \href{https://en.wikipedia.org/wiki/Hexspeak}{Hexspeak}.
228
-
229
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
230
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
231
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232
- \section{Proof of Work}\label{sec:score}
233
-
234
- The system consists of nodes (server machines), which maintain the data.
235
- In order to guarantee data consistency among all distributed nodes
236
- there has to be an algorithm of data segregation.
237
- Corrupted data must be detected earlier and filtered out as quickly as possible.
238
- Bitcoin introduced such an algorithm and called it \emph{proof of work}~\parencite{nakamoto2008}.
239
-
240
- Its fundamental principle is that each block of data must have a special
241
- number attached to it, known as \emph{nonce}, which is rather difficult to calculate,
242
- because it requires a lot of CPU power. It is assumed that at any moment
243
- of time the majority of nodes in the network invest their CPU power into
244
- calculating the nonces for the data that is not corrupted. If and when for any reason
245
- some data gets corrupted, the amount of CPU power a part of the network
246
- decides to invest into its nonces calculation would be smaller than what
247
- the other part of the network invests into legal data. The latter part
248
- will quickly dominate the former and the nodes with corrupted data will
249
- be ostracized and eventually ignored~\parencite{nakamoto2008}.
250
-
251
- Zold has borrowed this principle, although modified it. It also requires
252
- its nodes to invest their CPU power into meaninless and repetative
253
- calculations just to help us identify which part of the network they belong to:
254
- corrupted or not. Each Zold node has to calculate its \emph{score},
255
- which is as big as much CPU power the node has invested into its calculation.
256
-
257
- Similar to Bitcoin nonces, Zold nodes repeatedly calculate cryptographic hashes,
258
- looking for consecutive zeros inside them. First, in order to calculate a score,
259
- a node makes the \emph{prefix}, which consists of four parts,
260
- separated by spaces:
261
-
262
- \begin{enumerate}
263
- \item The current timestamp in UTC, in \href{https://en.wikipedia.org/wiki/ISO_8601}{ISO 8601},
264
- \item The host name or IP address, e.g. \dd{b2.zold.io},
265
- \item The \href{https://en.wikipedia.org/wiki/Port_(computer_networking)}{TCP port} number,
266
- \item The invoice.
267
- \end{enumerate}
268
-
269
- For example, the prefix may look like this:
270
-
271
- \begin{minted}{text}
272
- 2018-05-17T03:50:59Z b2.zold.io 4096 THdonv1E@abcdabcdabcdabcd
273
- \end{minted}
274
-
275
- Then, the node attempts to append any arbitrary text, which has to match
276
- \dd{/[a-zA-Z0-9]+/} regular expression, to the end of the prefix and calculates
277
- \href{https://en.wikipedia.org/wiki/SHA-2}{SHA-256 hash}
278
- of the text in the hexadecimal format. For example, this would be the prefix
279
- with the attached \dd{16bda66} suffix:
280
-
281
- \begin{minted}{text}
282
- 2018-05-17T03:50:59Z b2.zold.io 4096 THdonv1E@abcdabcdabcdabcd 16bda66
283
- \end{minted}
284
-
285
- The hash of this text will be (pay attention to the trailing zeroes):
286
-
287
- \begin{minted}{text}
288
- 5fa0681f220a2779b03b46456a19b38c0b635c1573dc01401dafee510000000
289
- \end{minted}
290
-
291
- The node attempts to try different sufficies until one of them produces
292
- a hash that ends with a few tailing zeroes. The one above ends
293
- with six zeroes.
294
-
295
- When the first suffix is found, the score is 1. Then, to
296
- increase the score by one, the next suffix has to be found, which
297
- can be added to the first 64 characters of the previous hash
298
- in order to obtain a new hash with trailing zeros, for example:
299
-
300
- \begin{minted}{text}
301
- 2018-05-17T03:50:59Z b2.zold.io 4096 THdonv1E@abcdabcdabcdabcd 16bda66 13d284b
302
- \end{minted}
303
-
304
- Produces:
305
-
306
- \begin{minted}{text}
307
- ce420bfdd2f6530db795e7ff4aa508bb0092735dd63d209da218cb78b000000
308
- \end{minted}
309
-
310
- And so on.
311
-
312
- The score is valid only when the starting time point is earlier than
313
- the current time, but not earlier than 24 hours ago. The \emph{strength} of the score
314
- is the amount of the trailing zeros in the hash. In the example above the
315
- strength is six. The larger the strength, the more CPU power it takes to earn
316
- the score. All nodes in the network must have the same strength of their scores.
317
-
318
-
319
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
320
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
321
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
322
- \section{Wallets}\label{sec:wallets}
323
-
324
- There is no central ledger in Zold, like in many other digital currencies.
325
- Instead, each user has their own \emph{wallets} (any number of them) with their own ledgers inside.
326
- Each wallet is an ASCII-text file with the name equal to the wallet ID.
327
- For example, the wallet in the file \dd{12345678abcdef} may include
328
- the following text:
329
-
330
- \begin{minted}{text}
331
- zold
332
- 0.6.4
333
- 12345678abcdef
334
- AAAAB3NzaC1yc2EAAAADAQABAAABAQCuLuVr4Tl2sXoN5Zb7b6SKMPrVjLxb...
335
-
336
- 003a;2017-07-19T21:24:51Z; ffffffff9c0ccccd; Ui0wpLu7; 98bb82c81735c4ee; For services;SKMPrVj...
337
- 003b;2017-07-19T21:25:07Z; ffffffffffa72367; xksQuJa9; 98bb82c81735c4ee; For food;QCuLuVr4...
338
- 0f34;2017-07-19T21:29:11Z; 0000000000647388; kkIZo09s; 18bb82dd1735b6e9; -;
339
- 003c;2017-07-19T22:18:43Z; ffffffffff884733; pplIe28s; 38ab8fc8e735c4fc; For programming;2sXoN5...
340
- \end{minted}
341
-
342
- Lines are separated by either CR or CRLF.
343
- There is a header and a ledger, separated by an empty line.
344
- The header includes four lines:
345
-
346
- \begin{enumerate}
347
- \item Network name, \dd{[a-z]\{4,16\}};
348
- \item Software version, \dd{[0-9]+(\\.[0-9]+)\{1,2\}} (\href{https://semver.org/}{semantic versioning});
349
- \item Wallet ID, a 64-bit unsigned integer in hexadecimal format;
350
- \item Public \href{https://en.wikipedia.org/wiki/RSA_(cryptosystem)}{RSA}
351
- key of the wallet owner, in \href{https://en.wikipedia.org/wiki/Base64}{Base64}.
352
- \end{enumerate}
353
-
354
- The ledger includes transactions, one per line. Each transaction line
355
- contains fields separated by a semi-colon:
356
-
357
- \begin{enumerate}
358
- \item \dd{id}: Transaction ID, an unsigned 16-bit integer, 4-symbols hex;
359
- \item \dd{time}: date and time, in \href{https://en.wikipedia.org/wiki/ISO_8601}{ISO 8601} format, 20 symbols;
360
- \item \dd{amount}: Zents, a signed 64-bit integer, 16-symbols hex;
361
- \item \dd{prefix}: Payment prefix, 8-32 symbols;
362
- \item \dd{bnf}: Wallet ID of the beneficiary, 16-symbols hex;
363
- \item \dd{details}: Arbitrary text, matching \dd{/[a-zA-Z0-9 -.]\{1,512\}/};
364
- \item \dd{signature}: \href{https://en.wikipedia.org/wiki/RSA_(cryptosystem)}{RSA} signature,
365
- 684 symbols in \href{https://en.wikipedia.org/wiki/Base64}{Base64}.
366
- \end{enumerate}
367
-
368
- Transactions with positive amount don't have signatures.
369
- Their IDs point to ID fields of corresponding beneficiaries' wallets.
370
-
371
- The \dd{prefix} is a piece of text randomly selected from the RSA key
372
- of the beneficiary wallet. It is used for security reasons, in order
373
- to make impossible ``wallet masquerading'' (pushing a new wallet with the
374
- same ID, but a different key).
375
-
376
- The combination \dd{id}+\dd{bnf} must be unique in the entire wallet.
377
-
378
- The \href{https://en.wikipedia.org/wiki/RSA_(cryptosystem)}{RSA}
379
- signature is calculated using the private key of the
380
- wallet and the following fields of transaction, separated by spaces:
381
- \dd{bnf}, \dd{id}, \dd{time}, \dd{amount}, \dd{prefix}, \dd{bnf}, \dd{details}.
382
-
383
- For example, this text may be used as a signing input:
384
-
385
- \begin{minted}{text}
386
- 12345678abcdef 003a 2017-07-19T21:24:51Z ffffffff9c0ccccd Ui0wpLu7 98bb82c81735c4ee For services
387
- \end{minted}
388
-
389
- Each transaction takes 1284 symbols at most.
390
-
391
- The order of transactions is not important, as long as their final balance is positive.
392
-
393
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
395
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
396
- \section{Mining Formula}\label{sec:formula}
397
-
398
- The only way to get ZLD is to receive it from the \emph{root} wallet
399
- with a system pre-defined ID \dd{0000000000000000}.
400
- This wallet is the only one that may have a negative ballance.
401
- However, to prevent an uncontrolled emission of ZLD, the balance
402
- of this wallet must satisfy the formula:
403
-
404
- $$t = \frac{h}{24 \times 1024}; \quad z = 2^{63} \times (1 - 2^{-t}).$$
405
-
406
- Here $h$ is the age of the root wallet in hours and $z$ is the maximum
407
- amount of zents it can issue at that moment. The first
408
- six years will look like this:
409
-
410
- \vspace{\parskip}\begin{center}\begin{tabular}{lrr}
411
- \hline
412
- Year & ZLD & Share \\
413
- \hline
414
- 1st & 470m & 22\% \\
415
- 2nd & 837m & 39\% \\
416
- 3rd & 1.1b & 52\%\\
417
- 4th & 1.3b & 63\% \\
418
- 5th & 1.5b & 71\% \\
419
- 6th & 1.7b & 77\% \\
420
- \hline
421
- \end{tabular}\end{center}
422
-
423
- The limitation is hardwired in Zold software and can't be eliminated.
424
-
425
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
427
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
428
- \section{Taxes}\label{sec:taxes}
429
-
430
- Each wallet must have to pay \emph{taxes} in order to be promoted by nodes.
431
- The maximum amount of tax debt a node can tolerate is 1 ZLD. This means
432
- that if the debt is smaller, all nodes must promote the wallet to their
433
- remote nodes. If the debt is bigger, a node will reject the wallet,
434
- which will make it impossible to make any new payments from it.
435
-
436
- The amount of taxes to be paid is calculated by the following formula:
437
-
438
- $$X = A \times F \times T.$$
439
-
440
- $A$ is the total age of the wallet,
441
- which is calculated as the difference in hours between the current time
442
- and the time of the oldest transaction in the wallet.
443
- $T$ is the total number of transactions in the wallet.
444
- $F$ is the fee per transaction/hour, which is equal to 7.48 zents
445
- (a one-year-old wallet with 4096 transactions must pay approximately 16 ZLD taxes annually).
446
-
447
- In order to pay taxes the owner of the wallet has to select any remote
448
- node from the network, which has a score of 16 or more. Then, it has to
449
- take the invoice from the score, request the node to lock the score
450
- for a minute, and send the payment of 1 ZLD or less
451
- to that node. The score with exactly 16 suffixes
452
- has to be placed into the details of the transaction,
453
- prefixed by \dd{TAXES }.
454
-
455
- The most active remote node will be selected as tax receiver.
456
- It's up to the payer which node to select.
457
-
458
- All tax payments inside a wallet must have unique scores.
459
- Duplicate tax payments are ignored.
460
-
461
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
462
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
463
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
464
- \section{Remote Nodes}\label{sec:remotes}
465
-
466
- Each node maintains a list of \emph{remote nodes} (their host names and TCP port numbers),
467
- their scores and their availability information. When the node is just installed,
468
- the list contains a limited amount of pre-defined addresses. The list is
469
- updated both by user request and automatically in order to give priority
470
- to high-score nodes and the nodes with the highest availability.
471
- Moreover, the node adds new elements to the list retrieving them from all
472
- available remote nodes.
473
-
474
- The built-in mechanism pays attention to the following factors of
475
- remote node \emph{quality} (in order of importance):
476
-
477
- \begin{enumerate}
478
- \item Visibility: the payer has to know the node,
479
- \item Availability: the amount of errors seen recently,
480
- \item Knowledgeability: the amount of nodes this node is aware of,
481
- \item Activity: the frequency of push requests the node originates,
482
- \item Score: the one reported during the most recent handshake.
483
- \end{enumerate}
484
-
485
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
486
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
487
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
488
- \section{Fetch, Merge, and Propagate}
489
-
490
- First, to see a wallet, it has to be \emph{fetched} from a number of remote
491
- nodes. The nodes may provide different versions of the same wallet, either
492
- because some data is corrupted or because modifications were made to the same
493
- wallet from different parts of the network. Each version retrieved from the
494
- network is stored in a local \emph{copy} and gets a score assigned to it.
495
- The score of the local copy is a summary of all scores of the nodes that
496
- provided that copy. Let's say, there are 17 nodes in the network and they
497
- provided three different copies of the wallet:
498
-
499
- \begin{minted}{text}
500
- copy-1: 78,090 bytes, 11 servers, 177 score
501
- copy-2: 56,113 bytes, 4 servers, 69 score
502
- copy-3: 97,132 bytes, 2 servers, 37 score
503
- \end{minted}
504
-
505
- The fetch operation ends at this point. The next step is to \emph{merge}
506
- all three copies into the local one, if it exists. The algorithm of merging
507
- is the following.
508
-
509
- First, the copy of the wallet we are merging into, is added to the list,
510
- with the score zero:
511
-
512
- \begin{minted}{text}
513
- copy-0: 55,991 bytes, 0 servers, 0 score
514
- copy-1: 78,090 bytes, 11 servers, 177 score
515
- copy-2: 56,113 bytes, 4 servers, 69 score
516
- copy-3: 97,132 bytes, 2 servers, 37 score
517
- \end{minted}
518
-
519
- Then, the copy with the highest score is assumed to be the correct one,
520
- which is the \dd{copy-1} in this example.
521
-
522
- Then, all other copies, in the order of their scores, are merged into the
523
- correct one, transaction by transaction, applied the following rules
524
- consequently:
525
-
526
- \begin{enumerate}
527
- \item If the transaction already exists, it's ignored;
528
- \item If the transaction is negative (spending money) and its ID is lower than
529
- the maximum ID in the ledger, it gets ignored as a fraudulent one (``double spending'');
530
- \item If the transaction makes the balance of the wallet negative, it is ignored;
531
- \item If the transaction is positive and its signature is not valid, it is ignored;
532
- \item If the transaction is negative and it's absent in the paying wallet
533
- (which is fetched and merged first), it's ignored;
534
- \item Otherwise, it gets added to the end of the ledger.
535
- \end{enumerate}
536
-
537
- When merge is done, the modifications get \emph{propagated} to other wallets
538
- available locally. Each transaction that has a negative amount is
539
- copied to the ledger of their receiving wallets (with a reversed sign),
540
- if it doesn't yet exist there.
541
-
542
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
543
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
544
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545
- \section{Pay and Push}
546
-
547
- To send money from one wallet to another, the owner of the sending wallet
548
- has to add a negative transaction to it and sign it with the private RSA key.
549
-
550
- At any moment of time any node may decide to push a wallet to another node.
551
- The receiving node accepts it, merges with the local version, and keeps locally.
552
- Then, it \emph{promotes} the wallet to all known remote nodes.
553
-
554
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
555
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
556
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
557
- \section{RESTful API}\label{sec:api}
558
-
559
- There is a limited set of RESTful API entry points in each node.
560
- Each response has \dd{Content-Type},
561
- \dd{Content-Length}, and \dd{X-Zold-Version}
562
- HTTP headers.
563
-
564
- \dd{GET /} is a home page of a node that returns
565
- JSON/\href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1}{200}
566
- response with the
567
- information about the node, for example (other details may be added in
568
- further versions):
569
-
570
- \begin{minted}{json}
571
- {
572
- "version": "0.6.1",
573
- "score": {
574
- "value": 3,
575
- "host": "b2.zold.io",
576
- "port": 4096,
577
- "invoice": "THdonv1E@0000000000000000",
578
- "suffixes": [ "4f9c38", "49c074", "24829a" ],
579
- "strength": 6
580
- }
581
- }
582
- \end{minted}
583
-
584
- \dd{GET /remotes} returns the list of remote nodes known by the node,
585
- in JSON/\href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1}{200}:
586
-
587
- \begin{minted}{json}
588
- {
589
- "version": "0.6.1",
590
- "all": [
591
- { "host": "b2.zold.io", "port": 4096 },
592
- { "host": "b1.zold.io", "port": 80 }
593
- ]
594
- }\end{minted}
595
-
596
- \dd{GET /wallet/<ID>} returns the content of the wallet, in
597
- JSON/\href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1}{200}:
598
-
599
- \begin{minted}{json}
600
- {
601
- "version": "0.6.1",
602
- "body": "..."
603
- }\end{minted}
604
-
605
- If the wallet is not found, a
606
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5}{404}
607
- HTTP response is returned.
608
-
609
- If the client provided the pre-calculated MD5 hash of the wallet content in the
610
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26}{\dd{If-None-Match}}
611
- HTTP header and it matches with the hash of the
612
- content the node contains, a
613
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5}{304} HTTP response is returned.
614
-
615
- \dd{PUT /wallet/<ID>} pushes the content of the wallet to the node. The
616
- node responds either with
617
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.3}{202} (if accepted),
618
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1}{400} (if the data is corrupted),
619
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.3}{402} (if taxes are not paid),
620
- or
621
- \href{https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5}{304}
622
- (if the content is the same as the one the node already has).
623
-
624
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
625
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
626
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
627
- \section{Incentives}\label{sec:incentives}
628
-
629
- It is obvious that anonymous users will participate in Zold and maintain
630
- their nodes only if they have enough financial motivation to do that. Simply
631
- put, their expenses must be lower than the income they are getting in
632
- form of taxes. This Section analyzes the most obvious questions users
633
- may have, regarding their motivation.
634
-
635
- \subsection{To Stay Online}
636
-
637
- What is the reason for a node to stay online and spend its CPU power
638
- and network traffic? Each node is insterested in doing that because it
639
- hopes that wallet owners will pay taxes to its invoices. The software
640
- automatically decides which node to pay taxes to and the selection is
641
- made by the availability criteria. The node which is the most available
642
- and visible will get the majority of tax payments.
643
-
644
- \subsection{To Accept Wallets}
645
-
646
- Why a node would accept push requests and spend its storage space
647
- on the wallets coming in? If the node doesn't accept a push request,
648
- its availability rating decreases and other nodes will stop paying
649
- taxes to it.
650
-
651
- \subsection{To Advertise Other Nodes}
652
-
653
- What is the incentive to advertise other remote nodes via the \dd{/remotes} RESTful
654
- entry point and why can't a node always return an empty list, expecting its clients
655
- to always pay taxes to it? The software automatically prioritizes remote
656
- nodes by the amount of remote nodes it promotes. The longer the list a node
657
- returns, the higher its chance to be at the top of the list.
658
-
659
- \subsection{To Promote Wallets}
660
-
661
- What is the incentive to promote wallets to remote nodes, spending network
662
- traffic for this operation? Each node ranks its remote nodes also by the
663
- amount of push requests they send. Thus, in order to stay on top of the lists
664
- each node is interested to push wallets further.
665
-
666
-
667
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
668
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
669
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
670
- \section{Threats and Responses}\label{sec:threats}
671
-
672
- It is obvious that a distributed system that consists of anonymous nodes
673
- even theorecially can't be 100\% safe, reliable, secure and trustworthy.
674
- Zold is not an exception. However, it's designed in an honest attempt
675
- to mitigate all critical threats and make the system ``reliable enough.''
676
- This Section summarizes the most import of those threads and explains
677
- how Zold responds to them.
678
-
679
- \subsection{Double Spending Attack}
680
-
681
- It is possible to submit the same spending transaction to the same wallet
682
- and then push it to two different nodes in different parts of the network.
683
- They won't know about each other and will propagate those spending
684
- transactions to other wallets. Both two owners of those money receiving
685
- wallets will think that their money arrived, while only one of them is
686
- a legit receiver, the other transaction is fraudulent.
687
-
688
- This will happen, but very soon one part of the network will dominate the other
689
- one, and one of the transactions will be rejected from the wallet, after
690
- a number of merge operations in all nodes of the network. The receiver of the
691
- money must be careful and always to the full fetch (from as many
692
-
693
- \subsection{51\% Attack}
694
-
695
- A group of nodes can combine their CPU power in order to win the consensus
696
- algorithm and add fraudulent incoming transactions to a wallet.
697
- The fetching node will trust the wallet ``as is'' and will think that the
698
- balance of the wallet is larger than it actually is.
699
-
700
- This may happen, but a fetching node may always re-validate the entire wallet,
701
- by checking RSA signatures of all transactions. This will take some time, but will
702
- provide an extra guarantee to the client.
703
-
704
- \subsection{Fraudulent Tax Refunds}
705
-
706
- Some nodes may resell their scores to their affiliated tax payers, and they
707
- refund them some amount of taxes back. This will be profitable both for
708
- the tax payers, since they will pay less taxes, and for the node owners,
709
- since they will receive the payments anyway.
710
-
711
- This scenario is indeed possible, but it is assumed that since tax payments are
712
- supposed to be made in small increments and automatically, the majority of
713
- clients won't be interested in this fraudulent scheme.
714
-
715
- \subsection{Loss of Wallet}
716
-
717
- A wallet is just a text file, which can easily be lost by it owner.
718
-
719
- This indeed is possible, but is not a risk at all, since all wallets are
720
- maintained by the network and anyone can easily pull any wallet back.
721
- The only sensitive part is the private key of the wallet. If that file
722
- is lost, the wallet can't pay anything anymore. This is the file all
723
- wallet owners must keep safe.
724
-
725
- \section{Conclusion}
726
-
727
- To be written...
728
-
729
- \printbibliography%
730
-
731
- \end{document}