Transactions on a blockchain have to be signed. You do this with a public and private key. It prevents people from spending coins that aren't theirs.
We'll use the
ecp256k1 elliptic curve to generate a keypair. The same algorithm used in Bitcoin. But you can use other algorithms as well.
The code used in this video is available on GitHub.
Feel free to fork it, improve it and open pull requests!