Could an IBM mainframe from the 1960s mine Bitcoin? The idea seemed crazy, so I decided to find out. I implemented bitcoin mining math problem Bitcoin hash algorithm in assembly code for the IBM 1401 and tested it on a working vintage mainframe.
It turns out that this computer could mine, but so slowly it would take more than the lifetime of the universe to successfully mine a block. How Bitcoin mining works Bitcoin, a digital currency that can be transmitted across the Internet, has attracted a lot of attention lately. If you’re not familiar with how it works, the Bitcoin system can be thought of as a ledger that keeps track of who owns which bitcoins, and allows them to be transferred from one person to another. The interesting thing about Bitcoin is there’s no central machine or authority keeping track of things. Mining requires a task that is very difficult to perform, but easy to verify.
Bitcoin mining uses cryptography, with a hash function called double SHA-256. With a cryptographic hash, there’s no way to get a hash value you want without trying a whole lot of inputs. But once you find an input that gives the value you want, it’s easy for anyone to verify the hash. The dark blue boxes mix up the values in non-linear ways that are hard to analyze cryptographically. If you could figure out a mathematical shortcut to generate successful hashes, you could take over Bitcoin mining. The Ch “choose” box chooses bits from F or G, based on the value of input E. Internally, the computer was very different from modern computers.
Since it was a business machine, the computer used decimal arithmetic instead of binary arithmetic and each character of storage held a digit, 0 through 9. Performance comparison The IBM 1401 can compute a double SHA-256 hash in 80 seconds. It requires about 3000 Watts of power, roughly the same as an oven or clothes dryer. 125,600, which is about a million dollars in 2015 dollars. Networking You might think that Bitcoin would be impossible with 1960s technology due to the lack of networking.
Would one need to mail punch cards with the blockchain to the other computers? While you might think of networked computers as a modern thing, IBM supported what they call teleprocessing as early as 1941. Conclusion Implementing SHA-256 in assembly language for an obsolete mainframe was a challenging but interesting project. The decimal arithmetic of a business computer is a very poor match for a binary-optimized algorithm like SHA-256. How many cards did you have to throw away before you had the complete program?
I developed the program on the ROPE 1401 simulator, so I only needed to punch it once. MY first computer experience was programming a Honeywell computer using cards punched on an IBM punch card machine. Add to this, we were supposed to write and debug the program on paper, computer time was expensive, so we lost 5 points credit for every time we ran the deck of cards after the first. I really enjoy your writing, especially on the Z80, since I worked on the Z80 and the 68000 while at Mostek in the early 80s. Its called “Digital Apollo – Human and Machine in Spaceflight”, by D.
It covers a lot of ground about the Apollo computer and control systems, at a technical level, but you don’t need to understand Control Theory to follow it. I plan to look at the Apollo Guidance Computer in more detail at some point. Kaos: I’ve update the text to make it clearer. Randy: my previous article on the 1401 went into much more technical detail, so I didn’t repeat the details here. I’ll let you know if I manage to get it doing SHA-256 hashes.