Bitcoin Mining Process - The Unreasonable Fundamental Incertitudes
Bitcoin Mining Process - The Unreasonable Fundamental Incertitudes
Bitcoin Mining Process - The Unreasonable Fundamental Incertitudes
Bitcoins are a type of digital currency which can be stored on a computer, though
it is advisable to store them rather in a more secure way. For example on paper
and in a safe, or on a smart card or another highly secure platform.
Bitcoins use the concept of so called “Proofs or Work” which are solutions
to certain very hard cryptographic puzzles based on hash functions. However
these solutions are NOT bitcoins. The puzzles are rather part of the bitcoin
trust infrastructure. In fact the puzzles are connected together to form a chain
and as the length of this chain grows, so does the security level. Bitcoins are
simply awarded to people who produce these “Proofs or Work” which is a very
difficult task.
Ownership of bitcoins is achieved through digital signatures: the owner of a
certain private key is the owner of a certain quantity of bitcoins. This private
key is the unique way to transfer the bitcoin to another computer or person.
The operation of so called bitcoin mining or creating bitcoins out of the thin
air is not only possible. It is essential, it is encouraged, and it is a crucial and
necessary part of the Bitcoin ecosystem. Cryptographic computations executed
by a peer-to-peer network of a growing network of currently some twenty thou-
sand independent nodes [20] are the heart of the security assurance provided
by this virtual currency system. It would be very difficult and extremely costly
for one entity to corrupt all these independent people. The sum of all this col-
lective computational work provides some sort of solid cryptographic proof and
prevents attacks on this system. This also how the network polices itself: miners
are expected to approve only correctly formed transactions. Bitcoin implements
a specific sort of distributed and decentralized electronic notary system without
a central authority. Well almost. Certain decisions about how the system works,
what exactly the bitcoin software does and how [6], are still pretty centralized.
They are subject to adoption or rejection by the wider community.
In a nutshell, bitcoin miners make money when they find a 32-bit value which,
when hashed together with the data from other transactions with a standard
hash function gives a hash with a certain number of 60 or more zeros. This is an
extremely rare event. It is in general believed that there is no way to produce
these data otherwise than by engaging in very long and costly computations.
This question of feasibility of bitcoin mining and possible improvements is a
central question in this paper and we study it later in more details.
H2 < target.
Here target is a large integer which is a global variable for the whole bitcoin
system worldwide, and on which all the participants worldwide are expected to
agree. The value of target slowly changes with time and is adjusted approxi-
mately every 2 weeks. More details are given below in Section 7.1.
The job of bitcoin miners is to find these solutions and publish them. They
are rewarded with some bitcoins for their work. In 2013 the reward is 25 BTC (25
bitcoins) per valid solution. How exactly this reward works and how it changes
over time will be explained later.
It is generally believed that there is no other method to achieve success than
trial and error; hashing at random as depicted on Fig. 2 until a result with a
sufficient number of leading zeros is found. However this is unlikely to be true,
there is always a better way, at least slightly, see Section 12.
target ≈ 2256−60.00 .
Fig. 3. One compression function in SHA-256. It comprises a 256-bit block cipher with
64 rounds, a key expansion mechanism from 512 to 2048 bits, and a final set of eight
32-bit additions.
The block size in this block cipher is 256 bits, the key size is 512 bits which
is expanded to 64 subkeys on 32 bits each for each of 64 rounds of the cipher.
The first 16 subkeys for the first 16 rounds are identical to the message and are
copied in the same order cf. [33] and later Fig. 12.
In addition in order to hash a full message, SHA-256 applies a Merkle-
Damgard padding and length extension which makes it a secure hash function
for messages of variable length. In the pre-processing stage, we must append one
binary 1 and many zeros to the message in such a way that the resulting length
is equal to 448 modulo 512, cf. [33]. Then we append the length of the message
in bits as a 64-bit big-endian integer.
Fig. 4. The internals of SHA-256 when hashing a 640-bit message as used in the first
application of SHA-256 in bitcoin mining.
Fig. 5. Our CISO problem seen as three applications of the underlying block cipher as
in bitcoin mining.
11 Our Optimizations
11.1 Improvement 1: Remove First Compression Function
We can reduce the cost factor from 3.0 to 2.0 almost instantly by making the
following observation. In the process of bitcoin mining the first compression
function does not depend on the random nonce on 32 bits. Therefore we can
compute it once every 232 nonces. On average we need
1
2.0 +
232
compression functions. The added factor is the amortized cost of the first hash
and can be neglected.
Important Remark. In more advanced bitcoin mining algorithms the miner
does not have to compute the output for every nonce. He can do it only for
some well chosen nonces. They may be chosen in such a way as in order to
obtain specific values which make the computation easier. Moreover, some well
chosen nonces could be generated in some specific order in order to enable incre-
mental computations. In an incremental computation some computations could
made easier by reusing all the (known) internal values in one or several previ-
ous computations. There is a lot of highly non-trivial optimizations which can
be developed. One simple example of incremental computation will be given in
Section 11.4, another in Section 11.11.
Here Wt is the key derived from the message and Kt is a certain constant
[33]. For t = 3 we have W3 = nonce. Now it is obvious that the whole round 3
can be computed essentially for free in the incremental way. We just need two
32-bit increments instead of one whole round which is about 7 additions and 4
other 32-bit operations. Each time we increment the nonce we simply need to
increment two values (in columns A and E) at the output of round 3, which is
shown on Fig. 8 below.
Fig. 9. Key in the first 16 rounds out of 64 in each computation and their provenance.
sci+1 = ai bi ∨ ai ci ∨ bi ci
1
We call it Improvement X and we do not give it a number in this paper as this
improvement also concerns full SHA256 implementations in ASIC and has already
been applied by most ASIC designers. In this paper we focus on the difference
between fully functional general-purpose ASIC and a specific solution for bitcoin
mining.
Fig. 11. How to compute one round of SHA-256 with just two full adders
Now we are also going to look beyond the 64 rounds of SHA256 seen as a
block cipher. What remains is the key expansion which expands the message to
be hashed into the 64x32 bit keys Wt .
Fig. 12. The message scheduler expanding a 512 message block into a 2048-bit key for
the SHA-256 block cipher.
11.10 Improvement 7: Saving Two More Additions
We consider the computation of H1. It is possible to see that the first two non-
trivial keys W16 and W17 are also constants and do not yet depend on the nonce.
This is because following Fig. 12 we have:
The Unreasonable
Long-Term Property
13 The Unreasonable Artificial 4 Year Cycle
Is there anything wrong with bitcoin at all? In the following sections we are
going to argue that bitcoin has at least one property which is truly unreason-
able and which needs to be changed in the near future. In fact we are going to
discuss something which has not yet been observed. A predicted cycle of 4 years
in bitcoin markets and data. However bitcoin has been in existence for just over
4 years and market data have been heavily distorted and blurred by tremendous
growth of the number of bitcoins in circulation and large capital inflows. Un-
der these circumstances our obscure 4-year property has not attracted a lot of
attention. It is however an undeniable fundamental and built-in feature of the
current bitcoin virtual currency system and it cannot possibly be ignored.
We recall the mechanism known as Block Reward Halving which exists in all
current bitcoin software [6, 7]. Every 4 years the amount of bitcoins awarded to
a successul miner will be divided by 2. It is 25 BTC as of 2013.
The origins of this property are obscure. It was NOT proposed in the original
paper of 2008 cf. [51] which simply says that any needed rules and incentives
can be enforced. It simply is a fact hard coded in the current software,
cf. [6, 7]. This mechanism is very closely related to the fact that the monetary
supply of bitcoins is fixed to 21 million. In fact this is how the 21 million cap is
implemented. The reward halving and 21 million cap are two faces of the same
property. In this paper we describe it only briefly, we refer to [8, 9] for a more
detailed explanation and discussions concerning the reasons why this peculiar
property is as it is. It may seem that this property is a sort of software bug,
however contrary a the software bug this property is very frequently applauded
and praised. It appears that we are the first to seriously criticize this property.
To summarize we have a 4 year reward cycle in the bitcoin digital currency
as we know it. Here is how exactly this mechanism works. Initially prior to
November 2012 all new CISO hashes were rewarded with 50 BTC. Currently
it is at 25 BTC for all blocks starting at 210,000 This reward price is going to
stay stable until roughly end of 2016, and then it will drop to 12.5 BTC for
another period of 4 approximately years. Then in each period of 210,000 blocks
the reward is going to be halved again.
More precisely every 210,000 blocks at every block which is an exact multi-
ple of 210,000 the reward is halved for the next 210,000 blocks. It is a sudden
abrupt change which takes place approximately every 4 years (but not exactly)
depending on the actual speed with which the block have been generated. We
should note that 210,000 is exactly 1 % of the 21 million and we have an infinite
geometric progression with a finite sum. Our mechanism can be described by the
following formula. Let t = 210000 ∗ f , the reward for any period of time t ≥ 0 is:
Summary. The key point is that with the current mechanism, at fixed mo-
ments in time it suddenly becomes twice more costly to mine bitcoins. These
sudden jumps occur every 4 years and are bound to have very serious financial
consequences. It suddenly makes miners stop mining and switch their devices
off. Overnight. This must lead to serious perturbations in the market.
The fact that this depreciation of the work of miners happens by sudden
jumps every 4 years is very surprising. It is bound to have some serious conse-
quences in all bitcoin-related markets.
With current bitcoin software [6, 7], at certain moments in time the reward for
mining is divided by two in one single step. This is NOT compensated by the fact
the the difficulty of mining increases all the time. It just adds sudden adjustments
every 4 years to a difficulty curve which typically goes systematically up due to a
steady increase in the production of new hashes. We predict that in the future the
difficulty curve will have a discontinuity at the moment of the 4-year halving.
Until now it has not happened because apparently only very small percentage
of active mining devices were switched off on 29 November 2012.
Inevitably, on one day many devices will stop being profitable and many
people may lose their interest in bitcoin. We are talking about the human factor.
Investors may decide that they are no longer going to give lots of money to a
high-tech industry which has just decreased production of hashes per second and
is binning many mining machines at a massive scale due to a strange rule which
has no justification and could easily be modified. They might move their money
elsewhere and invest in another cryptocurrency. Overall we expect that a sudden
slump in profitability of mining is likely to provoke some sort of a much larger
ripple in the bitcoin markets, potentially lasting up to 4 full years.
To summarize we claim that the current bitcoin reward rule has important
consequences. It creates an artificial economical cycle for the whole the industry
of bitcoin mining, for investors, and for traders who trade bitcoins. There will
be large capital inflows and outflows, there will be privileged moments to invest
money and make profits. Likewise it is extremely likely that there will be peri-
ods of time of excessive production of SHA-256 hashes which will no longer be
profitable. Depending on the market price offered for bitcoin an over-production
might force the miner of less profitable devices to switch them off earlier than
at the boundary privileged moment where the reward is halved.
13.3 The Inextricable Dilemma of Reforming How Bitcoin Works
Interestingly this cyclical property is easy to fix, bitcoin technical authorities
and developers and stake holders can agree to patch the bitcoin protocol, and
to smooth the thresholds of delivery of new bitcoins to bitcoin miners.
However they will hesitate a lot and will be faced with a certain dilemma:
1. Either we will be criticized by the financial press and media that bitcoin
is not exactly as stable as government-issued currencies and that it
has some truly unreasonable cyclic properties.
2. Or we will fix this problem. Technically it is extremely easy. It just requires
a majority of people to agree. Then suddenly bitcoin could become more
stable and therefore more like a currency.
Now if we change the way in which bitcoins are awarded, any decision made
will have very serious consequences and it would be extremely difficult to change
again.
Fig. 13. Our proposal for smoothing the miner reward mechanism
Remark. Yes this means that for the first half on the 4-year period the
reward will be first bigger than before, and only eventually later it will be smaller.
This is inevitable if want to maintain the same production of 21 millions of
bitcoins in the long run and have one single closed formula to use.
Correctness. We give here a calculation sheet in Maple which proves the
correctness of our reward scheme. For comparison we do it also the previous
(original Satoshi) reward scheme.
>#Satoshi
>15.75+sum(210000*12.5/2^(f-2),’f’=2..infinity)/10^6;
21.00000000
>#New formula
>15.75+sum(336*25.0*(625/624)^((1250-k)),’k’=1250..infinity)/10^6;
21.00000000
Examples. We give here below some concrete examples of rewards with the
old formula and the new formula. We see that with the new scheme for a long
time the miner reward is higher than before. We contend that this property is
probably impossible to avoid if we want to maintain a geometric progression in
one single closed formula, the 21 million cap and continuity at block 420,000.
block 105, 000 210, 000 420, 000 420, 336 525, 000 630, 000 840, 000 1050, 000
date 01/2011 11/2012 11/2016 11/2016 11/2018 11/2020 11/2024 11/2028
old formula 50.0 25.0 12.5 12.5 12.5 6.25 3.125 1.5625
new formula 50.0 25.0 25.0 24.97 15.16 9.18 3.378 1.2417
Fig. 14. Examples of reward with the old and the new system
14 Summary and Conclusion
In this paper we explain how bitcoin electronic currency works and show that
the profitability of bitcoin mining depends on a certain cryptographic constant
which we showed to be at most 1.89. Normally very few people care about this
sort of fine cryptographic engineering details. However here it is different. This
observation alone allows bitcoin miners to save many millions of dollars each
year. The biggest incertitudes however do not come from cryptography.