ZCash Mining

TransAmDan

Forum Admin
Staff member
Well been a little busy recently, so thought I'd give an update of what I have been up to, none of it is car related.

You know I got that Bitcoin miner, It was the S5 model, and a few years old, was making around £1.20 a day, there is an S9 which will make around 11 times that. Its basically processes transactions, its all encrypted, but it’s a validation tool. You join a pool of people all doing the same thing. The more hashing power you have the more reward. Well I sold it, and was going to get the S9, but decided against it for now as it’s a lot of money. Also would generate twice the amount of heat than the S5, The S5 would happily heat our office of 7x20meters, we had to have the windows open, lol.
Well there are other crypto currencies in their infancy.
Like ZCash which is ZEC. You can make money with GFX cads and CPU, with the GeForce1060 6GB it makes around £1 a day. I have the source code, mainly interested in the CPU code at the moment, I can step through the code and one function takes around 20 seconds. It moving data from pointers, rearranging RAM basically. Still digging into how much RAM it needs. My aim is to pass this data into an FPGA, I design the code to work the same as the PC code but faster, and pass the data back to be submitted. It’s a challenge. Its been on my mind for many days now. If I can make the FPGA chip work as fast as a PC thread then I will be happy. ZCash algorithum is designed to use more RAM so its not in favour of going into an FPGA/ ASIC, but I see that as a challenge. I can use external RAM, get multiple busses going. Then multiply up the FPGA designs, build is modular so you can chain more and more together.

I will write an article on ZCash, like I did for the Bitcoin miner.
Possible a blog for the progress of the ZCacsh programming/FPGA.
 
Sorry Dan - I'm lost lol
 
But why sell so soon after purchase? What's the thought process?

The S5 was a few years old, mining speeds increase every year. I wanted to see how it all worked, buying one that was in my budget was more of a test. It proved it could earn money if electric was free. There is an S7 and S9 model which has better crunching power and used less electric. From my speed test of the S5, i worked out the S9 would make around 90quid a week, and use £4 of electric a day. So to buy the S9 I needed funds, there is a waiting list for the S9 too, pay in full now for delivery January. So I may go for it.
However in the meantime I'm exploring the ZCash mining, it's similar to how Bitcoin works.
 
Certainly worth considering. I will take a look into that. Been making some progress on ZCash. Not sure what speed I can get from it yet.
 
Been Zcash mining on the Pc for well over a month name, made about £50 in the last month.

Most evenings and weekends I have been looking into improving the speed I have it built on the PC, and trying to migrate the code into an Arm processor, even though a lot of it is written in C++ it seems to be a different form that does not compile. Its beating me at the moment, but I wont let it win.
 
I should have kept the bitcoin miner S5, however it was a tad noisy, and generated a lot of head. With the rise of the value of bitcoin to around £8500 a unit. So around 2.5 more than when I was mining at £1.20 a day, so would be around £3 it would be making now. Oh well, perhaps I should have kept it, but then it could have packed up before it made its money back, it would have taken well under 100 days.

I'm still investigating the other crypto currency, ZCash. Its around £240 per unit at the moment, making £2.4 in 36 hours. So not huge. This is mainly from the GFX card in the first post. I'm still going through the code that runs on the PC, to find out how it all works and can it be optimized. I'm sure it can.

You use a Header of 108 bytes and a 32 byre nonce. Generate a hash, this is using the Blake2b compression, which is mainly additions, and Xors and cycling round many times of 16 x 64 bit numbers. You end up with a 512bit hash. In one piece of PC code it looks like its generates 1,000,000 of these 512 bit hashes. The code seems to reserve memory slots oin the fly and stored these values. From these numbers it looks like it used Wagners Birthday Problem https://pdfs.semanticscholar.org/3ce6/544a379e240be41a9ddb8c52597ac5e48e8b.pdf
I wonder if we store these values at set offsets, then we can retrieve them quicker. My code has access to 512Mb of RAM, and looks like its required around 180Mb, so by spreading out we may be able to fetch it quicker.

Its been slow going, and following someone elses code in view on how to optimise it when you dont fully understand what they are trying to achieve is taking me a while. Can it be faster than a GFX processor? well if the code really does require 180Mb of RAM, and the GFX card has 6GB, it has over 700 Cuda cores but i think the RAM will be the limiting factor. So it could be running around 30 instances of the solver.

Still a lot of unanswered questions. I believe I can make it faster, but at what cost, I do not know.
 
?Once concern was how much network bandwidth does it requier. Well on the PC I ran Wireshark and monitors data's between me and the ZCash mining pool. Around 1K was downloaded, then 5 seconds later a couple of packets around 100 bytes were sent back and the cycle repeated. This is a very low data transfer. So not going to impact on my network that much.

Heatwize, it may generate a couple of Watts per chip, so looking at one of these to mount the board to.
LA 6/150 12V FISCHER ELEKTRONIK, Fan / Force Cooled Heat Sink, Hollow Fin Aggregate, 0.175 ?C/W, 74 mm, 62 mm, 150 mm, 56 m?/h | Farnell U
Need to progress more with functional achievements and than I can find out the power requirements and go from there.
 
I'm still working on this project, so thought I'd post an update. I have worked on soo many areas on this. Its hard to find/follow what the original code on the PC does, now I think I am getting close.

My hardware I am developing on is a ArtyZ7. Its a board with a Xilinx FPGA with a built in Dual core processor running at around 700Mhz. While its clocking speed is slower than a PC, my aim is to get it working in C code and then convert that code into FPGA code so it will run much faster. Some of that code has already been converted.

So basically my board needs to do the following:-
  • connect to the internet and subscribe for new work.
  • Receive the new work
  • Receive the Nonce
  • Receive the Target
  • Generate 2 million 192bit numbers from the work, nonce by hashing using the Blake2 method.
  • Do 9 levels or sorting for duplicates on the 2 million numbers
  • Generate binary tree resulting in 512 x 32 bit numbers from the results on previous stage.
  • SHA256 hash on the binary tree
  • Compare SHA256 results with Target, if less then send result to the internet.

There are around 2 results per block, but not all of them will meet the target, so we need to keep repeating while changing the nonce. The result sent back contains the modified nonce.

Currently the hashing part is in the FPGA and runs very slick, its limit is the speed of access to DDR3 ram, at 1066mb/s hardware limit it is quick, but I need to work on the interface to get it faster.
The SHA256 is proven in C and compared to the original PC code. I have converted most of that into FPGA code and verified, so that is pretty much complete. I done that in the weekend i was in the states, starting at 9am, working through to 6pm then grab meal and carry on afterwards, done this for both Saturday and Sunday. Made great progress.

So today I am working on the connection to the internet, it will talk to the server and grab new work, many fields are being grabbed fine, just getting it to grab the nonce.

I am hoping my board will be able to submit a result before Christmas. This started back in September 2017, its been a long time now. Even when my board submits a result it wont be faster than a PC. I need to move the 'sorting' part of the code into the FPGA to see a real speed advantage. Once it is submitting results, I will be optimising many parts of the design.

So this is what i have been spending soo much of my free time on. But Why? well its a challenge, I like optimising things, to be honest when I started this project i thought it would only take a couple of months. The project was far bigger than I first thought. I thought it would just be a case of taking around 1k bytes, hashing them with some algorithm and send back the result.
 
Yes, I will get ordering parts soon. Been saving nicely recently, will be nice to get the garage widened. Also need a paint job.

As for the mining code. My board connects to the internet, grabs the work information. Processes it in a number of seconds, throws away ones not in target, and sends off the valid ones. It appears to be doing the submit command correct. Perhaps my format is incorrect or perhaps my results are wrong, but I get no confirmation back. I will be using wireshark again to compare data packets from the PC and from my board. The results will be different, but should confirm the format and length.
 
Last edited:
We have been saving too, but every penny is going to the new house and all the new furniture we are buying.
Maybe 2019 will bring a Hellcat?!
 
Maybe 2019 will bring a Hellcat?!
Maybe you will have a surprise in your new garage. You open the doors for the first time to find Clare has brought you a Hellcat.
 
:jaw:
:love:
 
The FPGA miner is working. Finally got there, well happy and over the moon right now. My aim was to get it working first before optimising to make it faster.

Now you would think and FPGA miner would be quick, this isn’t yet. The hashing is done in the FPGA fabric and completes in around 0.1 seconds, the sorting is done in C on a 700Mhz processor, this will be moved into state machines so my limitation is with the DDR interface. Next will be a wider connection to DDR 64 or 128bit with 2gb or 4gb of DDR ram, Ready for the BEAM or the 150,5. I’ll need to build hardware for the DDR ram, it will take it as an SODIMM form.

Feels like i have created a child that is now finding its way in the world. :yo:

So this board is using TCP-IP to connect to the server via the Statum protocol, signs in with a username and password, gets work, using the FPGA to hash this work, then the processor does the 9 levels or sorting and indexing then SHA256 and comparing with target before submitting the result. The result is now being accepted its been a long journey, 17 months i have been on this now. Next is to make this things faster :) a great project, and really happy its finally got to this point.
 
So which part of the Otto cycle are you on when the #6 piston is coming up on the and the intake valve has just shut!!!!!!!!
;)

Just pulling your leg! Sounds complex but hopefully the results will be worth it?
 
Last edited:
Its a great adventure. Feels like I'm achieving something, however it is taking up a lot of my time, taken me away from the forum.

There is more for me to do on it. As although the 64Mb of data is created in the FPGA, the sorting is done on a CPU, so a lot slower. My next step is to do this n the FPGA too. At least I now know what every step needs to do, where before I was reverse engineering someone else's code.

I have been documenting my findings along the way. It could be useful for someone else on the same journey. There are forums for the ZCash mining, but this is mainly people with GFX cards running software to produce the result. I have created hardware to do the same job.
 
Back
Top