Bitcoin Mining 55-year veteran of IBM 1401

Inspired by the publication habrapolzovatelya mark_ablov « Mein Bitcoin via pen and paper », we decided that readers will giktaym wondering what other crazy ideas able to realize the author of the original post - Ken Shirriffu. i>

Can I use the IBM mainframe comes from the 60s of the last century Mein Bitcoins? I decided to test this, at first glance, a crazy idea. I implemented a hash algorithm Bitcoin in assembly code for the IBM 1401 and tested in practice by running it on a workable model of this ancient mainframe.

Card, which is calculated using the SHA-256 hashes on the mainframe IBM punched card 1401.Za visible printing on the printer, showing the input of the algorithm and the resulting hash i>

As it turned out, with the help of the computer can be Main, but the process takes so long that even the lifetime of the universe may not be enough for a successful single block of mining.

While modern hardware allows to calculate hashes billions per second, the computer in 1401 spends 80 seconds to compute a single hash. Progress performance of computers over the past decade there that clearly described Moore's Law.

Punch cards, participated in the experiment, as well as printing SHA-256 line printer shown in the photos (the first card is a beauty - it was not easy to break this pattern). Note that the second line ends with a group of zeros; This means a successful hash.

The principle of the system of mining Bitcoin
In recent years, electronic currency Bitcoin (Bitcoin), which Internet users can send each other, is very popular. To understand the essence Current cryptocurrency, Bitcoin system can be represented in the form of a log book in which a record of the owners of digital coins (Bitcoin) and the number of coins that he / she has. Buyers Bitcoin can transmit digital coin each other.

It should be noted that the system Bitcoin decentralized: it does not have a single regulatory server, which would follow the course of the transaction. Instead, we are distributing the records of a distributed network of thousands of computers on the Internet.

The difficulty lies in the fact that such a distribution system must somehow ensure that the consent of all users on the records. That is bona fide users should confirm the validity of a transaction, approve it, in spite of the possible presence of scammers and slowly working your network. The solution to this problem was the so-called "mining". About every 10 minutes during the outgoing unit of mining confirmed the transaction, as a result, he is considered to be officially confirmed.

The process of mining, based on a robust cryptography, is extremely difficult, so that no one can control exactly which transactions are mining. In particular, the key idea of ​​Bitcoin is that the result of complex and difficult to obtain, but it is easy to check. This is the so-called technology «proof-of-work» («proof of work»).

The process of mining block requires an enormous amount of computing costs. However, after the unit has been certified, the users peer network can easily verify its validity. The complexity of mining prevents fraudulent use of Bitcoin, and ease of verification unit allows users to be confident in the validity of the transaction.

A side effect of mining is adding new Bitcoin system. Currently, anyone who confirmed the unit receives a 25 generated Bitcoin (now the cost of the number of virtual coins in traditional monetary terms is about 6 thousand. USD). This promotion encourages "miners" to work hard and spend its resources on mining. Given the available opportunity to get to 6 th. US dollars every 10 minutes, mining represented a real "gold mine", encouraging users to spend significant sums on hardware for of mining.

line printer and IBM mainframe in 1401, presented in the exposition of the Computer History Museum (Computer History Museum). This computer is running my program. The console is located at the top left. Black rectangular panel on the computer is a "door" racks that recline, allowing access for maintenance. I>

The process of mining extremely difficult, but the result is very easy to check. The Bitcoin Mining uses cryptography hash function, called SHA-256 double. Hash portion takes the input data and reduces it to a smaller hash value (in this case 256 bit).

A cryptographic hashing algorithm will not yield the desired hash value without exhausting the weight of the input data. However, after the entry is found, which gives the desired value, one can easily check the hash. Consequently, a cryptographic hash is a good way of the «proof-of-work» Bitcoin.

In more detail, in order to smaynit unit must first collect a new block transaction. Then it is necessary to produce a hash block to produce (essentially random way) hash value of the block. If the hash value begins with 16 zeroes, the block is deemed to have confirmed and sent to the network Bitcoin. Most of the time a hash is not successful, so you slightly change the unit and try again and again, spending more than one billion computing operations. About every 10 minutes, someone can successfully confirm the unit and the process begins anew. This is reminiscent of the lottery, which involves miners, attempting for the attempt, as long as someone does not become a "winner." The complexity of the hashing process is difficult visual presentation: it is easier to find a grain of sand in the whole of Earth sand than finding the valid hash value. To find these hash values ​​miners use data centers equipped with special hardware for of mining.

Many explanations for this article, I deliberately simplified. If you want to learn more about the system and Bitcoin mining, I advise to study my articles Difficult Bitcoin mining experience and harsh lessons of mining Bitcoins . < br />
The hash algorithm SHA-256 is used Bitcoin
Now I will discuss hashing function used Bitcoin, which is based on standard cryptographic hash function, called SHA-256. The system uses Bitcoin "double SHA-256." This means that the function SHA-256 is performed twice. SHA-256 algorithm is so simple that it can perform literally being available only pencil and paper , and this algorithm allows you to mix data in unpredictable ways. The algorithm takes as input blocks of 64 bytes, cryptographically processes the data and outputs the 256 bit (32 byte) encrypted data. The algorithm uses a single round, which is repeated 64 times. The illustration below shows one round of an algorithm that takes eight 4-byte blocks, and through H, performs several operations and provides new values ​​for A through H.


See also

New and interesting