# Blockchain Technology for Secure Communication and Formation Control in Smart Drone Swarms
## 3 Background  
### Blockchains  
The foundation of blockchain technology is the concept of a digitally decentralized system that enables fully transparent transactions to be carried out without the need for a central intermediary. Although it was initially designed for financial transactions and the use of cryptocurrencies, it has since gained popularity across a wide range of industries because of its capacity to enhance system security, performance, and transparency [20].  
Blockchains consist of blocks (Figure 1), which are a data structure that encapsulates all the necessary data on a specific transaction. Their structure can be divided into two parts: the header and the body. The header contains the hash value of the previous block, the hash value of the Merkle tree (hash binary tree) root, a timestamp (which defines the creation of the block), and a nonce (a number that miners must find in order to match the exact hash pattern of a particular blockchain). The body part contains a transaction list and a counter [21].  
From the standpoint of the network, blockchains are typically peer-to-peer (P2P) systems in which a transaction is broadcast to all nodes when it has been created. Every new transaction is signed using the creator's private key and can be validated by all other nodes using that node's public key. This feature of blockchain technology is quite useful since it enables UAV swarms to withstand unauthorized access attempts. Every transaction conducted by an intruder using a key that the swarm determines is invalid will not be recognized as genuine. It is actually a type of authentication mechanism that blockchains can offer. Also, secure communication can be established in the same channel by using public and private keys to encode and decode the data, respectively. Specifically, data can be encoded by the sender drone using the receiver's public key. Next, the receiver drone can decode the data using its private key. In this way, data theft by a threat actor can be avoided (Figure 2).  
Another key feature of blockchains is the consensus mechanism [22]. Blockchains' decentralized nature necessitates a system so that all participants can agree on the legitimacy and order of the transactions. Therefore, there is no need for a central authority to be responsible for such actions. PoW (Proof of Work) is the most well-known algorithm miners use to try to determine the nonce in order to achieve a specific pattern in the block's hash (begins with four zeros, for example). Typically, brute-force techniques are used for this, which are highly computationally expensive. PoS (Proof of Stake), PoA (Proof of Authority), and PBFT (Practical Byzantine Fault Tolerance) are more deterministic, efficient, and environmentally friendly algorithms. This is the main reason why most blockchains tend to adopt these mechanisms instead of PoW.  
The most practical technology in the context of blockchains is undoubtedly smart contracts. An automated transaction procedure can be created with just a few lines of code. When the parties reach an agreement, the transaction is signed and sent for verification over the network. The most well-known blockchain platform that supports the execution of smart contracts is Ethereum. For the creation of smart contracts on Ethereum, a Turing-complete language called Solidity has been created.  
Based on the layered architecture (Figure 3) of blockchains, which is proposed in [23], this work focuses on the contract and application layers, as we can see in the following figure.  
Figure 1: Typical block structure.  
Figure 2: Data theft attacks can be avoided due to data encoding.