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

another issue not finding genesis block #5

Closed
jlopp opened this issue May 5, 2024 · 2 comments
Closed

another issue not finding genesis block #5

jlopp opened this issue May 5, 2024 · 2 comments

Comments

@jlopp
Copy link
Contributor

jlopp commented May 5, 2024

Running latest version of master, this took 4 minutes on my machine:

./generate-genesis -nonce 1 -psz "03/May/2024 Bitcoin block" -timestamp 1714777860 -pubkey 000000000000000000000000000000000000000000000000000000000000000000
Ctrl Hash:	0x0000000074d0d22027690df0c540b7892a735a28f27f2259dfc36abefef4a47f
Target:		0x00000000ffff0000000000000000000000000000000000000000000000000000
Blk Hash:	0x0000000074d0d22027690df0c540b7892a735a28f27f2259dfc36abefef4a47f
Mkl Hash:	0x25b153370db436b43fe33df10bb93eb8655b93e5102cacf7889d7b61bd181c5b
Nonce:		1300206773
Timestamp:	1714777860
Pubkey:		000000000000000000000000000000000000000000000000000000000000000000
Coins:		5000000000
Psz:		'03/May/2024 Bitcoin block'

This command found a solution in a couple minutes:

./generate-genesis -nonce 1 -psz "03/May/2024 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e" -timestamp 1714777860 -pubkey 000000000000000000000000000000000000000000000000000000000000000000
Ctrl Hash:	0x00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043
Target:		0x00000000ffff0000000000000000000000000000000000000000000000000000
Blk Hash:	0x00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043
Mkl Hash:	0x7aa0a7ae1e223414cb807e40cd57e667b718e42aaf9306db9102fe28912b7b4e
Nonce:		393743547
Timestamp:	1714777860
Pubkey:		000000000000000000000000000000000000000000000000000000000000000000
Coins:		5000000000
Psz:		'03/May/2024 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e'

But this one ran for over half an hour without finding anything and exhausting the nonce space:

./generate-genesis -nonce 1 -psz "03/May/2024 Bitcoin block 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e" -timestamp 1714777860 -pubkey 000000000000000000000000000000000000000000000000000000000000000000
nonce was reset. Timestamp is now 1714777861
@mycroft
Copy link
Owner

mycroft commented May 5, 2024

I do not think there is an issue here. You're just being unlucky and it just takes time to find a valid hash with the parameters. I was able to get one valid hash with your parameters and it took 30-45 min on my end unfortunately:

$ ./generate-genesis -nonce 0 -psz "03/May/2024 Bitcoin block 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e" -timestamp 1714777860 -pubkey 000000000000000000000000000000000000000000000000000000000000000000 -workers 48 -maxprocs 128

Ctrl Hash:      0x00000000f3c23edbdaabb23bab7598874aed89a515ef182c121f7469c9b8b05e
Target:         0x00000000ffff0000000000000000000000000000000000000000000000000000
Blk Hash:       0x00000000f3c23edbdaabb23bab7598874aed89a515ef182c121f7469c9b8b05e
Mkl Hash:       0x44c6a56ff59c8016031e3be56c4c9d60fa95086a7803a454f7b507084d0c6e12
Nonce:          3185950820
Timestamp:      1714777866
Pubkey:         000000000000000000000000000000000000000000000000000000000000000000
Coins:          5000000000
Psz:            '03/May/2024 Bitcoin block 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e'

It went from timestamp 1714777860 to 1714777866 which means it computed like 30 trillions signatures (~60 trillions sha256 unless I'm wrong) to get there.

Please remember this piece of code is written in golang which is definitely not the best language for this kind of stuff as I'm 100% sure our modern CPUs could handle a lot more hashes/sec and have faster results.

However, it's been a while I did not profile golang compiled stuff but I might give a look to find out if there is no quick win scenario to have faster results. I've already added configurable workers/GOMAXPROCS flags to customize cpu usage but golang seems to limit cpu usage to 85% here (50% prior modification)

@jlopp
Copy link
Contributor Author

jlopp commented May 5, 2024

Aha, fair enough!

@jlopp jlopp closed this as completed May 5, 2024
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