Signing a contract on the blockchain

Most if not all of us have signed a contract before, be it digitally printing it on PDFs or physically with a pen.

How does this translate to the contracts on the blockchain?

Suppose we have a contract which states various clauses which have to be satisfied.

This contract is usually several pages long. As such we can’t possibly transfer it over the blockchain, considering the costs incurred.

What we can do however, is to hash it.

This generates a number (also known as a hash as well), which we can use to verify its legitmacy.

The hash is significantly smaller than the original contract, and can be transferred over the network.

Next, we want to sign the “contract”.

To do so, we get the other party to use their private key to sign it,

returning v, r, c parameters (instead of their private key).

These parameters can then be used by the eth function ecrecover to obtain the original network address of the signatory.