I need a Python(2 or 3) Monero miner that outputs hashes to terminal.
Please ask me if you need clarification.
I need a Python(2 or 3) Monero miner that outputs hashes to terminal.
Please ask me if you need clarification.
I'm assuming this is a follow-up question to your previous question.
Here is an example that shows how to hash a block hashing blob with a supplied nonce:
import binascii
import pycryptonight
import struct
bhb = binascii.unhexlify("070786a498d705f8dc58791266179087907a2ff4cd883615216749b97d2f12173171c725a6f84a00000000fc751ea4a94c2f840751eaa36138eee66dda15ef554e7d6594395827994e31da10")
nonce = 1234
bin = struct.pack('39B', *bytearray(bhb[:39]))
bin += struct.pack('I', nonce)
bin += struct.pack('{}B'.format(len(bhb)-43), *bytearray(bhb[43:]))
hash = pycryptonight.cn_slow_hash(bin, 2)
print(binascii.hexlify(hash))
Where bhb
is the binary of a blockhashing_blob
as returned from a call to get_block_template, and nonce
is your nonce for this particular hash.
To create a miner, follow the steps in my answer to your other question.