# Proof of Elapsed Time consensus algorithm

## Consensus algorithms

Consensus algorithms are an essential part of the blockchain technology. They are used to ensure that the “main chain” at every node of the network is the same. This results in a consistent state of the blockchain. According to Andreas Aandopoulos (a tech entrepreneur),​ consensus algorithms have formed a new discipline in the field of computer science.

## Proof of Elapsed Time

Proof of Elapsed Time (PoET) is an efficient alternative to proof of workA consensus algorithm used by Bitcoin (PoW). In the case of PoW, an expensive computation is required to create a candidate block and propagate the message to other nodes in the network. It is expensive because it incurs a cost for the electricity utilized by the special mining hardware (designed specifically to calculate the hash-value) in order to mine the next block in the blockchain. The node that is able to find the hash-value first becomes the new leader and gets a reward in the form of Bitcoins.

However, in PoET, a separate random timer that operates independently at every node determines whether or not that node creates the new block of the blockchain and gets the reward. This randomization also ensures that every node is equally likely to be the winner.

### Security

The PoET algorithm is for permissioned blockchain networks. That is, a special verification is required from a node when it tries to join the network. This verification is achieved using Intel’s Software Guard Extension (SGX)A set of instructions built into the Intel CPUs technology which was first introduced in 2015. It creates an attestation for a piece of code and protects the code from external access.

### Process

The network operates in the following way:

1. A node downloads the PoET code and generates an attestation (key) for the code using SGX.

2. The node forwards this key when requesting to join the network. The nodes that are already a part of the network verify this key.

3. The new node now has its own timer object which is initialized to a random value. This randomness is guaranteed by the code protection offered by SGX.

4. All nodes are initialized with a random time; the first one to expire gets to be the winner. This means that it creates a new block, attaches it to the current blockchain, and gets the reward. Then, the nodes are initialized again.

RELATED COURSES