The Blockchain Explained to Web Developers, Part 1: The Theory
5 stars based on
56 reviews
The focus of mining Bitcoin ever faster is to use custom hardware, but what about the algorithms? How much effort has been expended on optimizing the bitcoin algorithm java of work task?
It is a tough problem, but it could save a lot of energy and make some money. At the moment to create new Bitcoins a miner has to solve a cryptographic problem. When they have solved the problem they have verified a block of Bitcoin transactions and they get some newly-minted Bitcoins for bitcoin algorithm java trouble.
The big problem bitcoin algorithm java this is that the algorithm contains a difficulty factor which is adjusted to make the bitcoin algorithm java to solve the problem roughly constant at about 10 minutes. This is only a problem because as time goes on Bitcoin miners are throwing ever more hardware at the problem in an effort to bitcoin algorithm java the first to solve the block.
Even though bitcoin algorithm java mining machines do their best to reduce their power consumption the total power being used to mine Bitcoin is surprising - just bitcoin algorithm java of Megawatt hours per day. As well as considering algorithmic efficiency, the paper also considers many other issues, but it is its central section that is most interesting to developers.
The mining problem is to find a bit value that when added to the current block gives an SHA hash that is smaller than a specified value. Sometimes there is no value can be found for the hash problem and in this case some other elements of the block can be modified or the miner can ask for a new block with a similar set of transactions.
So the huge electricity bill comes from the need to compute the SHA hash function a lot of times. Clearly to make bitcoin algorithm java mining go faster all we have to do is speed up SHA For arbitrary data this would be a very difficult task, but for a Bitcoin block it is easier because we are computing the hash of mostly the same data over and over.
However, the details bitcoin algorithm java complicated. The SHA hash is actually used twice in the Bitcoin algorithm. First the byte block is padded to make it bytes. Then the SHA ia applied to produce a bit hash which is then padded to bytes and hashed a second time. To make it work as a hash, the data input is fixed and the data from the block is used as a byte key, producing a byte hash. If you want to hash more than bytes then the cypher is used as many times as needed.
So in the first hash computation it bitcoin algorithm java used twice and in the final hash it is used once. If you are prepared to break open the black box that is the SHA hash then you can regard it, in the Bitcoin case, as being three applications of the cypher - as shown in the diagram below taken from the paper:.
The red bitcoin algorithm java indicate data that change each time the trial value is modified. You can see that once the hash on the first bytes has been computed you don't have to do it again. This is a big saving. However it isn't unknown and all but the most unsophisticated mining software already makes use of it. From here the bitcoin algorithm java explores other improvements in the algorithm, mostly delivering only bitcoin algorithm java speedups compared to the obvious big one.
One optimisation is to stop the final hash calculation early when it becomes obvious that the result is not going to have the required number of zeros. It is also possible to reuse results in the calculation of the first hash. Looking deeper inside the cypher blocks, it is also possible to find parts of the calculation that remain the same and you can exploit fixed constants, especially zero values. At this level it comes down to counting how many additions or multiplications are being saved.
Taking everything together, the paper concludes that the Bitcoin hash can be computed in about 1. This sounds good, but you need to keep in mind that the first optimization, which is probably already in use, brings the value down to 2 and so the extra optimizations reduce this by only about 0.
The real value of this work is to open up the possibility that, due to regularities in the computation, there might be even better ways of computing the SHA hash in the case of Bitcoin.
Just because the hash is difficult to invert in the general case this might not hold in the specific case of Bitcoin. It is also worth exploring the possibility that computing trial bitcoin algorithm java in a particular order might lead to a faster iterative approach using results from each computation more efficiently in the next.
Whatever the success of such efforts, it is bitcoin algorithm java keeping in mind that such an improvement would be temporary. The Bitcoin algorithm sets the difficulty level bitcoin algorithm java the problem to keep the time to solve at around ten minutes. So unless someone finds solution that makes even the hardest problem easy to solve, it's just part of the arms race. Of course, if this was to happen the Bitcoin algorithm would be broken. Flaw In Bitcoin Algorithm. Hardware Mines Bitcoins Faster.
Bitcoin still standing - but panic takes over. Inside Bitcoin - virtual currency. Bitcoin gains an open source client. Digital currency lets GPU cycles print money. Apple has made its FoundationDB core open source, and wants all future major development to be carried out openly. Apple acquired FoundationDB in Android Programming In Kotlin: If you are prepared to break open the black box that is the SHA hash then you can regard it, in the Bitcoin case, as being three applications of the cypher - as shown in the diagram below taken from the paper: RSS feed of news items only.