Skip to content

kriuchkov/power

Repository files navigation

PoW protocol by TCP

Algorithm overview

The algorithm has been implemented in such a way that the server transmits a hash with a nonce. It is necessary for the client to find the nonce based on the following parameters: a dynamic byte index, a byte value and the server hash.

The objective is to ensure that the client cannot easily forge the result in order to obtain the message from the server.

Steps for Implementation

Server-side logic

The server generates a random nonce, creates a hash using a predefined method, and transmits the hash, the byte index and the byte value to the client. The server then awaits the client's computation and return of a correct hash based on the verify message.

Important Concepts

  • Nonce: A random value generated by the server.
  • Hash: Typically created using a secure hash algorithm (e.g., SHA-256).
  • Byte index: A dynamic index based on its IP address that the client must find in order to compute the correct hash.
  • Byte value: A byte value that the client must find in order to compute the correct hash.

Client-side logic

The client receives the verify message from the server and then computes the correct hash by appending or manipulating the nonce, index, and value in some way (based on the protocol). This is then sent back to the server.

The client must then find a hash that satisfies the server's requirements:

  • Certain number of leading zeros.
  • Contain specific bytes patterns.

Detailed Steps

Diagram Explanation

  • Step 1 shows the server generating a nonce and hashing it before sending it to the client.
  • Step 2 represents the client receiving the verify message and attempting to find a valid hash.
  • Step 3 shows the client sending the computed nonce back to the server.
  • Step 4 depicts the server verifying the nonce and determining if the hash is valid or not.

Check using Docker

  make docker-run

About

PoW protocol by TCP (client <-> server)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published