Crypto Currency and Blockchains

Crypto Currency and Blockchains

Distributed Systems:

A distributed system is a collection of machines or “nodes” which work towards a common goal across a network.
Within distributed systems ordering is vital. For example if the system is performing financial transactions then they must happen in the order that they are sent. Requests may be sent to different nodes but they must know which order they should all work in, this is done using a clock.
In distributed systems a clock is used to order requests/transactions. The clocks used are based on a system for numbering requests and a concept known as happened before.
What is often done to maintain the happened before relationship is that a node will broadcast its clock number for a transaction when received.
If you are a node receiving this broadcast of say a clock number of 101, and your clock is currently at 29. You will update your clock to be 101, you’re next request will be number 102. Maintaining this order.
Since this is done over a network we can assume there will be failures and packet loss. So it is not necessarily true that all nodes are aware of all transactions. So to combat this before you can write to a centralised memory or database you send out a broadcast message requesting to access the memory. When you do this it is because your request is next in your list. However you cannot write until every other node acknowledges that this is next.

Distributed Systems

If we imagine the above is all of the queues of nodes. A will try to execute request 12. However B and C will both acknowledge negatively. Because A is unaware of event 10. B will then request to run 10. A will acknowledge because 10 is before top of its queue, C will acknowledge too because it agrees that 10 is next in the queue. 10 will then be written to the database or memory etc.

Crypto Currency:

Crypto Currency such as Bitcoin is a virtual currency. Meaning that it only exists in a virtual manner. These currencies are exchanged using cryptographic techniques to verify transactions between users.
One difference between traditional currencies and Crypto Currencies is that crypto currencies do not use a centralised control as we had discussed above. These currencies work on a similar ledger of transactions. However these are not written to a centralised database or file like in the example above. However these use a decentralised control without a need for a trusted admin. Meaning that while they still use a distributed system to manage and track transactions, they do not all have to request to write to a singular database or file.

Blockchain:

Blockchain is the name of the decentralised system either used to create these currencies and their transaction lists, or is used as a basis to create currencies similar to the predominant and famous Bitcoin which was the first implementation of a Blockchain.
Blockchain was designed to be a distributed system which was secure and lacked the need for a trusted administrator.
A block chain is made of blocks which are chained. By this I mean that a block is defined as a block of valid transactions. The chain is a way of linking blocks together. This is done by a block storing the hash of its previous block. This links the two blocks and prevents a block from being altered.
The Blockchain works with the idea that similar to the previous example. Not everybody has a complete history of transactions. So to combat this each implementation requires an algorithm or a way to score a history. Upon a node receiving a version or a block with a higher score than its own it will start to use this and broadcast to other nodes about this change. This keeps the nodes synchronised to an extent.
Something to note is that it is often set up that adding new blocks produces a higher score than editing existing blocks. This deters people simply changing the current block to their advantage.

What makes the Blockchain secure?

Decentralisation of the data is one aspect which makes this secure. It does not have a single point of failure. Meaning that if one server or node goes down then there are others to continue the service. This also allows for the use of public and private keys. Using the public key as a user’s address and using the private key like a password.
Storing a hash of previous blocks. This ensures that the further down the chain you go the more trusted a block can be. The hash ensures that a block cannot be changed as it would be invalid.

Some of the Cryptography explained:

Hash:

A hash function is a function which takes some sort of input and generates a fixed length string from this input. The main properties of a hash function are:
• it is quick to compute the hash value for any given message
• it is infeasible to generate a message from its hash value except by trying all possible messages
• a small change to a message should change the hash value so extensively that the new hash value appears uncorrelated with the old hash value
• it is infeasible to find two different messages with the same hash value
Read More here

Public and Private Keys:

The idea of public and private keys is that a public key is a large number or string of numbers which can be made available publicly to anybody. Whereas a private key must be kept private. These keys are 2 numbers which relate in a way that if you encrypt something with a person’s public key. Only their private key may decrypt the message.
Read More here