Using Delphereum, you can now sign messages entirely off-chain in Delphi, without interacting with the Ethereum network. Signing and the verification of messages allows tamper proof communications outside of the blockchain.

Generating the Signature

Clone Delphereum. Launch Delphi. Start a new project. Please make sure the dependencies are in your search path. Then copy and paste the following code:

Please note that you will need to replace the private key in the example above with your own.

Warning! You should never give your private key to anyone. You should write your private key down on a piece of paper, and then store that in a safe. Every time a piece of software asks you for your private key, a big red alarm must go off in your head and you should double verify what you are doing.

If you do not have a wallet on the Ethereum main net, then you can create one on MyEtherWallet or MyCrypto.com. If you don’t want to create a wallet at this time, then you can use these test vectors:

public key:

0x12890d2cce102216644c59dae5baed380d84830c

private key:

b5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7

Validating the Signature

Solidity provides a globally available function named ecrecover that returns an address given a signature. If the returned address is the same as the signer’s address, then the signature is valid.

Because we don’t want to write a Smart Contract at this time, we will be using the following service on etherscan:

This page will allow you to verify any Ethereum-signed message signature. Please enter your Ethereum address, the generated signature and the message that has to be verified.

Note that any attempt to tamper the message or signature will result in an address that is different than the signer’s address. This ensures that the integrity of the message and signer can be enforced.

Congratulations! You have just generated a cryptographic signature in Delphi, and then verified that signature on the Ethereum blockchain.

In the next article, we will build on this concept and sign a transaction so that we can send cryptocurrency over the network.