Skip to content

Implementing Challenge Solver in other language #23

Answered by tranxuanthang
Dr-Blank asked this question in Q&A
Discussion options

You must be logged in to vote

I understand that it needs to work out the nonce that was used given the prefix and the taget_hex by repeatedly hashing the "{prefix}{nonce}" string and comparing it to target.

You understood it correctly. In short, you must find an unknown nonce so that the the sha256 hash of {prefix}{nonce} is smaller than the target.

The current target's hex:

000000FF00000000000000000000000000000000000000000000000000000000

Is present in an u8 array as:

[0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

For example, the following prefix:

kyhYEjsjkxcxHRliu3oOLQUodVumo6ur

Then the first nonce (from zero) that is valid is:

42660891

Because the sha256 of k…

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@Dr-Blank
Comment options

@tranxuanthang
Comment options

@Dr-Blank
Comment options

@tranxuanthang
Comment options

@Dr-Blank
Comment options

Answer selected by Dr-Blank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants