Proof of Work

Submission Deadline:

The goals of this exercise are to:

  1. Register an account on the assignment submission server
  2. Write a TCP client that implements a proof-of-work protocol

Class Account

Assignments will be submitted using a hosted GitLab instance. Register an account using your email address. You will need to enable 2FA using an authenticator app of your choice. You should also associate an SSH key with your account.

Points will be deducted from your grade if you lose access to your account!

Proof-of-Work Protocol

The docker image at contains a server that implements a simple proof-of-work protocol on port 11111/tcp. Using the language of your choice, implement a client for the protocol

\[ \begin{align*} S \rightarrow C &: L \\ S \rightarrow C &: N^L \\ C \rightarrow S &: N^LX^{64-L} \\ S \rightarrow C &: M \\ \end{align*} \]

where \(L\) is a two-byte big-endian length, \(N^L\) is a nonce, \(N^LX^{64-L}\) is a 64-byte value prefixed by the nonce such that its SHA-256 hash starts with ns in ASCII, and \(M\) is an ASCII message. Your client must obtain an OK message from the server at the final step.

When writing your client, you should anticipate and handle behavioral variances due to, e.g., network congestion or different protocol implementations. Your client will be evaluated against multiple powd servers.

Submission Instructions

Commit and push the source code for your client to GitLab in the repository ${your_gitlab_user}/powd. The latest commit on master will be considered your submitted solution. Your repository root must also contain a Dockerfile that will build an image that runs your client against a host given as the first argument. That is, given a built image, running

$ docker run -it ${image_name}

must execute your client against a powd server running at on port 11111/tcp.