How to make your own cryptocurrency

Cryptocurrency is only possible because of the technologies that came before it. Technologies that could only come about because of increasing computing power and improving communication speeds between computers.

Some of the main technologies are:

Cryptography which is used to verify that transactions are authentic.

Blockchain to record these validated transactions and keep them from being modified.

The Internet and Peer-to-peer (P2P) computing for distributed computing and holding a distributed validated database of transactions.

Cryptocurrencies work because they can be run without any element of trust between all the parties involved. The technology makes it so that any of the parties involved have a role to play and no one can break the system.

A good way to learn how cryptocurrencies work is to try and build one yourself. Instead of going into any level of detail into each of the technologies, we can just talk about what they are expected to do.

A simple ledger

Lets start with a group of friends, Alice, Bob and Charlie who share an apartment. They frequently buy things on behalf of each other. Every time one of these transactions are made, it is written on a ledger. At the end of the month, they do a tally and settle the differences.

This is practical, but it also needs a high level of trust between all of them. It assumes that everyone will be faithful to the system and not try and break it.

Some of the ways that can happen are:

  1. Bob could put in any number of false transactions saying that he bought stuff on behalf of Alice.
  2. Charlie could ask the other two to buy everything for him that month and then disappear from the apartment.

So the system has to work without trust.

False Transactions

One way of dealing with false transactions is to get each of the parties to sign off any new transactions involving them. The signing has to be done in a way that can’t be forged.

This is where cryptography comes in. More specifically asymmetric cryptography. Here each signatory has a secret key and a public key. You sign a document using the secret key and you can verify the signature using the public key. The signature is tied to the transaction. Any change to the transaction will invalidate the signature, so there is no way of tinkering with the original transaction.

Every time Alice’s name is on a transaction, if she agrees with it, she will sign it.

But Bob could still make multiple copies of that transaction and also the signature.

This is the basis of blockchain technology, Alice should also validate the ledger when she confirms a new transaction. Validation here means that all the lines of the ledger have been validated up to the point of the new transaction. Each line should contain the signature from the previous line. Since only Alice can sign her lines she validates all transactions relating to her, then the integrity of the ledger can be maintained for historical transactions.

But what happens if Charlie substitutes the ledger with one that substitutes all historical transactions with false ones. This can be fixed if each of them has a copy of the ledger and any new transactions only go on to validated copies of the ledger.

If someone’s copy of the ledger doesn’t agree with the other two, ledgers, then they have to make a copy of the ledger that there is more consensus on.

Disappearing Parties

Everyone paying what they owe at the end of the month is another feature of this system that depends on trust. Everyone can leave at any time after racking up a lot of debt.

To keep this from happening, anyone coming into the system needs to have a buy in. They will put a certain amount into the kitty and only can transact up to that amount.

Scaling Out

If the world only contained Alice, Bob and Charlie, then this is beginning to look a lot like normal currency. The three of them could go about their day using this method as payment to each other.

Consider if all the people in the neighborhood heard about this system and wanted in. Suddenly from a few transactions each it increased to a lot more. The task of validating ledgers against other ledgers and adding the new transactions to all validated ledgers has now become too much to handle.

So they enlist a third party (known as a miner) to make sure all the ledgers are valid and only the valid transactions make it to the ledgers.

The problem here is that there is trust placed on the miner that he wont compromise the whole system and put in transactions that everyone owes him money.

You fix this by having multiple miners and each miner gets to work on random transactions. It is the miner’s job to validate a random transaction. Once it is validated, it is added to the ledger which is copied over to all the users. The miner is happy to do this because he gets paid a small amount to validate each transaction he has been given.

Those are all the steps you need to go through if you want to create your own cryptocurrency. They start becoming abstract after a while. Having multiple people have a copy of a rapidly growing ledger is not practical. It doesn’t even happen in real cryptocurrency. Everyone doesn’t even own their copy of the ledger but it exists as a distributed database.

I hope I have explained this well. If anyone reads the whole article I would like to hear from you and if there are any holes in my explanation. I will keep coming back to this and try and improve on in at much as I can.

Leave a comment

Your email address will not be published. Required fields are marked *