Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Michael Rolle on May 26, 2019, 08:28:45 AM



Title: Testing my own hashing code (continued).
Post by: Michael Rolle on May 26, 2019, 08:28:45 AM
(Edit) Reply to the last post of my previous topic from May 25, #5145912.0, "Testing my own hashing code".  I wound up accidentally creating a new topic here.

(Edit) Change 2x to 3x speed improvement.

Yes, I assumed that Bitcoin Core was an application that used external mining hardware.  That must be some other application that I was thinking of.
Looks like Bitcoin Core is more or less the original Satoshi reference implementation, and it does the hash within the program in software.
I appreciate the pointer to the sha256.cpp.  It's interesting reading.
I see that it has different versions for various x86 instruction sets, including the SHA instructions.  I can just replace the SHA version with my own.  I'm running on a Ryzen, which has the SHA instructions.

I'm curious about interfacing with a rig.  Can you tell me if the rigs being sold these days interface directly to the bitcoin network or whether they interface with a computer which interfaces with the bitcoin network.  In the latter case, what software is available to run on the computer, and is the interface between the computer and the rig standardized, or does the software need to be customized for each model of rig out there?

By the way, I believe my own software can do hashes more than three times as fast as that which comes with Bitcoin Core, because I've written it in assembler and taken care with the order of the instructions.  On the Ryzen, the latency of the SHA256RNDS2 instruction limits the time of a double hash to 192 cycles (3 64-byte blocks with 64 cycles each).  However, I've worked out a way to do multiple hashes in 64 cycles per hash, and that's the factor of 3 I referred to.  When I get around to it, I'll run a speed test on the sha256_shani code and post the results here.

Would there be any serious interest in publishing my code as part of Bitcoin Core, and would it be possible to license this particular module, or perhaps publish it as shareware, and earn a little money from it?  Obviously nobody would pay for the program to do mining for serious profit, because the power to speed ratio is hundreds of times too high.  But would anyone pay a little money for a 2x speedup to Bitcoin Core or any other product that does hashing in software?  I'd welcome any opinions about this.


Title: Re: Testing my own hashing code (continued).
Post by: achow101 on May 26, 2019, 04:18:53 PM
Bitcoin Core does not interface with ASIC miners directly. Bitcoin Core no longer contains efficient mining code because mining with a CPU is pointless and just a waste of energy. The implementation of SHA256 is just used for the computation of the hashes used all over Bitcoin, not for any mining purposes.

I'm curious about interfacing with a rig.  Can you tell me if the rigs being sold these days interface directly to the bitcoin network or whether they interface with a computer which interfaces with the bitcoin network.  In the latter case, what software is available to run on the computer, and is the interface between the computer and the rig standardized, or does the software need to be customized for each model of rig out there?
Asics these days can either connect to a mining pool directly or connect to a driver running on a computer which connects to the pool. Either way, they usually run some version of cgminer or bfgminer which are software that can communicate with these devices. These software also speak the stratum protocol used by pools and the getblocktemplate protocol used by Bitcoin Core (and some other pools).

Would there be any serious interest in publishing my code as part of Bitcoin Core, and would it be possible to license this particular module, or perhaps publish it as shareware, and earn a little money from it?
No, not as a part of Bitcoin Core.