I have been scanning the codes related to mining. I am new to erlang so I have a lot of questions hope someone can clear this up for me.
In order to mine you need to hash the header. I believe I can generate the header using the data from this api request http://127.0.0.1:3013/v2/key-blocks/pending
Now what algo is used to hash the header is it sha256? Where can I see the header structure?
Ive seen this comment so I am guessing it is sha256
%% The SHA256 hash is 32 bytes (44 chars base64-encoded), the nonce is 8 bytes
%% (12 chars base64-encoded). That leaves plenty of room (80 - 56 = 24
%% bytes) for cuckoo to put its nonce (which will be 0 in our case) in.
So to summarize I need to hash the header then concatenate the 64bit nonce and then base64 encode the 80-byte buffer.
Then pass the 80 byte buffer to cuckoo. once a solution is found convert it to binary then hash that binary to check the difficulty.
Once it passes the difficulty then post the solution to http://localhost:3113/v2/key-blocks
Did I miss anything?