Skip to content

What is HashCash? The algorithm that enables Bitcoin mining

May 6, 2020

HashCash is very easy to use. Basically, that’s what it does Set up a complex cryptographic job that needs to be resolved using the power of the computer it is running on. As a result dYou must return an alphanumeric string that serves as a witness that the work was successfully completed. In addition, this string should be used by a server to check whether this work was actually carried out correctly. The latter must be very easy to do.

In a nutshell, HashCash does a lot of cryptographic work to remove a string from it that can be easily checked in seconds. This puts the entire workload on the user side, while servers can only be used for checking and accessing the services that users need.

Application example

Now let’s look at some examples of using HashCash. For this we use GNU / Linux Debian as the operating system and the HashCash version, which we can install from the repository or the software memory. If you work on Windows, You can get a copy of this official link.

Create a proof of work

What is HashCash? The algorithm that enables Bitcoin miningWhat is HashCash? The algorithm that enables Bitcoin mining

For example, if we want to work a little, the command to enter is as follows:

hashcash -mb8 mytestwork

Now let’s explain a little what it all means. The “-m” option specifies “mint”. or create a new hash according to the defined HashCash Proof of Work protocol. nbsp; The “-b” option specifies “bits”. or the amount of cryptographic information you have will be output. This parameter is important because the larger the number of bits, the larger it is. The difficulty of creating the hash and more time will need us to create it. In addition to “-b” we have Number 8, that’s the number of bits we’re going to use.

As a result of the above command line, we get this result:

Hashcash token: 1: 8: 200422: myworkout :: rmLKoDkCYOxqM0K8: 00051

Regardless of the operating system used, the HashCash output for the specified command is á the same. That means that The HashCash work certificate is reproducibleand will always give the same result if you offer the same parameters. This cryptographic test took only a few seconds to create. However, if we go to the limit, it may take several hours for the program to get the answer.

Verification of proof of work

Now we know how to create proof of work with HashCash, but How do we check that? Well, for that we need to enter the following command:

hashcash -cb -r job_test hashcash_token

This would be as follows:

The “-c” option specifies “check”. or check. It will allow us to check that the proof of work is correct. The “-b” option also specifies the number of bits. This should correspond to the amount that was used to produce the proof of work. With the option “-r” or “resource” we can specify the origin or the data we use for the proof of work. And the hashcash_token data is the result we got with the previous command to generate the test. So í We have the resulting command to check our previous proof of work:

hashcash -cb8 -r myword test 1: 8: 200422: myworkout :: rmLKoDkCYOxqM0K8: 00051

So í We can easily verify the test, and as you have certainly verified, this process is practically instant, as it does not require any complicated work. As a result of this command, we get this output:

Matched token: 1: 8: 200422: myworkout :: rmLKoDkCYOxqM0K8: 00051

This tells us that the token is correct, and if it doesn’t, we get this output for a change or modification:

skipped: Token does not have enough bits

rejected: No valid tokens were found

check: failed

In addition to these examples, we can do a lot more with HashCash. However, these simple examples show you the potential of this software to perform cryptographic tests that we can review later.

Receive Breaking News !

Install
×
Enable Notifications    Ok No thanks