User:Smusleh/sandbox

Introduction
Blockchain technology was proposed in 2008 under the pseudonym Satoshi Nakamoto. The blockchain is always coined with peer-to-peer or distributed decentralized networks. Each of the two architectural concepts has its own advantages and disadvantages and their own specific way of doing things. Choosing a specific architecture has consequences on how you will achieve the functional and nonfunctional aspects of a system. In particular, both architectural concepts have very different approaches to ensure integrity. And this is the point where the Blockchain enters the picture. A Blockchain is a tool for achieving integrity or trust in a distributed software system. Hence, it can be seen as a tool to achieve a nonfunctional aspect of the implementation layer of a software system. Integrity is an important nonfunctional aspect of any software system. It has three major components: Data integrity: The data used and maintained by the system are complete, correct, and free of contradictions. Behavioral integrity: The system behaves as intended and it is free of logical errors. Security integrity: The system is able to restrict access to its data and functionality to authorized users only. Conceptually, Blockchain is a kind of peer-to-peer network with a distributed database where validity and of data is verified by peers. The consensus of peers is achieved based on predefined policies Proof of Work or Proof of Stake. Blockchain enables distributed peers to reach consensus in trust less network without centralized authority. In this article, we try to understand the idea and definition of Blockchain in the context of the Internet of things (IoT). What are the functional and non-functional challenges? of implementing Blockchain driven IoT services emphasizing the architectural and privacy by design concepts.

Definitions
The term Blockchain is ambiguous; it has different meanings for different people depending on the context. Blockchain can refer to:
 * A data structure or an algorithm or
 * A suite of technologies or
 * A group of purely distributed peer-to-peer systems with a common application area managing and clarifying ownership.

Daniel Drescher in his book defines Blockchain as a purely distributed peer-to-peer system of ledgers that utilizes a software unit that consists of an algorithm, which negotiates the informational content of ordered and connected blocks of data together with cryptographic and security technologies in order to achieve and maintain its integrity.

The Global Standards Initiatives on Internet of Things (IoT) defined the Internet of things as the infrastructure of the information society. Or a network of objects linked by a tag or microchip that sends data to a system that receives it.

Functional Challenges
Design issues and Architectural styles for Blockchain driven IoT Services Blockchain and IoT are both emerging technologies, the design issues and architectural styles of Blockchain-driven IoT (B-IoT) services are still not well explored. Chun-Feng, Sheng-Wen, Chinju and Kung Chen from National Chengchi University in Taipei Taiwan proposed 4 different Architectural Styles. They have provided a conceptual view of the Blockchain concept and process. The concept is that Blockchain is a kind of secured distributed database where the validity of data is verified by peers. The consensus of peers is achieved based on pre-determined policies (e.g. Proof-of-work or Proof of-stake). Therefore, Blockchain enables distributed peers to reach consensus in a trustless network without a centralized authority. Using this concept, the authors started investigating design considerations that are unique to Blockchain driven IoT (B-IoT) services. They have introduced three design considerations.


 * The first one is the location of Blockchain endpoints (also known as a node in many literature papers). In a Blockchain, network endpoints keep track of Blocks and verify transactions. In a proof-of-work Blockchain, endpoints also generate new blocks through a competitive mining process. This process requires heavy bandwidth, computations, and storage space requirements.


 * The second one is the distribution of business logic and data. The authors introduced smart contract as a useful alternative to implementing the business logic. The smart contract is a stored script in a Blockchain. It keeps track of the states of physical assets verifying them and storing them in a Blockchain. Placing too many functions and logic into Blockchain may introduce delays and performance issues.


 * The third one is the mechanisms of cyber-physical integration. These include issues surrounding and enabling micro-payments for renting or using the IoT thing or services. How can the IoT service provider control the service? As an example, once the payment is confirmed, the service provider unlocks the rented IoT using web-socket (off Blockchain) or by issuing a contract event (on Blockchain).

Architectural Style Design
service provider. This architectural style keeps most of the logic and data in the central database.
 * The first Architectural Style Design is Full Centralized. The user selects smart things and pays for a service portal. Most smart thing states and logic are stored in a local database. Business logic is implemented as web application and services. There is only one Blockchain and only one smart contract used to record payment flow. The smart thing is not aware of the Blockchain and it is controlled by the


 * The second Architectural Style Design is the Pseudo Distributed Things. The endpoints of each node are deployed and managed on the cloud. The smart thing and the end user device can interact with the Blockchain via chain gateway. In this architectural design, style endpoints are physically located in the cloud and logically attached to each smart thing.


 * The third Architectural Style Design is Distributed Things. The endpoints this time are located on the smart thing but they are equipped with lightweight clients which can perform partial tasks and keep partial data. This way the smart thing is controlled directly by the corresponding smart contract.


 * The fourth Architectural Style Design is Fully Distributed Architecture. This is the same as the third but the endpoints are also deployed on the end user device. This way no need for the service provider to implement the payment logic. The user pays directly to the address of the smart contract associated with the rented IoT thing.

Cloud and Fog Deployment of Blockchain as a service for IoT
Blockchain by definition is a distributed and decentralized ledger that contains connected blocks of transactions. Blockchain guaranties tamper-proof storage of approved transactions. The large practical value of Blockchain to IoT is due to the following facts: one it is distributed and decentralized and two its ability to create, store, and transfer digital assets in a distributed decentralized and tamper-proof way. Using the above-mentioned Blockchain features Mayra and Ralph in their paper try to use the Blockchain within IoT domain to manage device configuration, store sensor data, and enable micropayments. But a key challenge for them was the Blockchain deployment location.