Hi guys,
I am going through the open-source-fpga miner(
https://github.com/progranism/Open-Source-FPGA-Bitcoin-Miner/tree/master/projects) source and I had a doubt.
data <= {384'h000002800000000000000000000000000000000000000000000000000000000000000000000000000000000080000000, nonce_next, data_buf[95:0]};
The above data is then passed into the sha256 hash module which then proceeds to calculate the hash. I simply dont understand why we need to double hash the above data. According to the
https://en.bitcoin.it/wiki/Block_hashing_algorithm we need to convert every 32 bit chunk from little endian to big endian and then calculate the hash of that function. In the above example data_buf is a 256 bit register which holds 256 bits of the data returned from getwork. If we say the first version bit recieved from getwork is 1, then along those lines data_buf holds the value of bit 129-192 which has been endian shifted for every 32 bit chunk. But I still dont get why we have to calculate the hash as shown above in the code. Does someone know why hash is calculated in this manner?