# Blockchain Technology for Intelligent Environments
## 2 Blockchains  
In a nutshell, a blockchain is a giant _append-only_ log of transactions replicated across a set of participating nodes. When a new transaction is to be appended, participating nodes _vote_ on whether it complies with the blockchain's rules and come to an agreement regarding the _admission_ and the _order_ of new transactions. This agreement is known as _consensus_ and the protocol ensuring it is called the _consensus protocol_ (of the particular blockchain). Anyone can verify the validity of logged transactions, while no one may tamper with or purge past transactions.  
What makes blockchains a disruptive technology is that they offer, for the first time ever, a tamper-proof append-only database where trust emerges through the collaboration of a set of computers, rather than through an institution or organisation that imposes trust from the external world onto the system.  
In blockchains, data records (i.e., transactions) are grouped into blocks. The very first block, known as the _genesis block_, is a special block known to everyone. Each other block links to its previous block by incorporating a cryptographic hash (see also Section 2.3.1) of the previous block's contents, creating a _chain_ of blocks. In case a block gets tampered with, the hash stored in its successor will not match its (updated) content anymore, effectively breaking the link. That is, tampering with a block deprives it of its successors, rendering the altered block as the last block of this (altered) blockchain. Given the key blockchain policy that, among two or more blockchains rooted at the same genesis block only the longest one is considered valid, tampering with a block will result into a shorter-than-the-original blockchain, which will be instantly ignored by all correctly behaving nodes. That is, tampering with a block is not prohibited by means of traditional authentication and authorization protocols. Instead, it is merely rendered meaningless, as the majority will always follow the longest chain. As creating new blocks is made deliberately hard (see below), an attacker wanting to tamper with a block will have a very hard time in trying to produce a longer chain than the so-far longest one, effectively racing against the rest of the world in terms of computational power.  
Blockchains essentially constitute distributed ledgers, which is why blockchain technology is often referred to as _Distributed Ledger Technology_, or _DLT_. Technically speaking, DLT is a wider family of systems, as distributed ledgers that do _not_ group records into blocks have been proposed (such as IOTA discussed in Section 3.1.4). However, all dominant distributed ledgers to date are blockchains.  
Each blockchain is designed as a combination of certain elements. Identifying and understanding these elements is essential to the comprehension of blockchains and their inner workings, as well as for classifying them into different types. The core elements determining the operation of a blockchain are their _access model_, _token model_, _consensus protocol_, and _smart contract_ functionality, as depicted in Figure 1. These core elements are detailed in the following sections.