Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to add finded hash to txt file #4

Open
Mert-Zengin opened this issue May 25, 2021 · 1 comment
Open

I want to add finded hash to txt file #4

Mert-Zengin opened this issue May 25, 2021 · 1 comment

Comments

@Mert-Zengin
Copy link

   hash = hashlib.sha256(hashlib.sha256(binascii.unhexlify(blockheader)).digest()).digest()
    hash = binascii.hexlify(hash).decode()
#    print('hash: {}'.format(hash))
    if(hash[:5] == '00000'): print('hash: {}'.format(hash))
    if hash < target :
#    if(hash[:10] == '0000000000'):
	#file = open("buldu.txt", "a")
	#file.write('hash:{}'.format(hash)) <------- i added but didn't work 
	#file.close()
        print('success!!')
        print('hash: {}'.format(hash))
        payload = bytes('{"params": ["'+address+'", "'+job_id+'", "'+extranonce2 \
            +'", "'+ntime+'", "'+nonce+'"], "id": 1, "method": "mining.submit"}\n', 'utf-8')
        sock.sendall(payload)
        print(sock.recv(1024))
#    else:
#        print('failed mine, hash is greater than target')

when i try to add getting error tab

@iceland2k14
Copy link
Owner

This file code you added will be triggered only when you get the BTC Block. because it is inside the condition if hash < target
If you want to look at all the hash generated during computation in a file then you can output it below the Line 80.

solominer/solo_miner.py

Lines 80 to 81 in 6e2e1f6

hash = binascii.hexlify(hash).decode()
# print('hash: {}'.format(hash))

Put the code there you will see the hashes saved in your file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants