**What this course is about** - It's about blockchain technology and related applications - Provides a very general introduction - We will discuss the main components of a blockchain - We will deal with some technological aspects - We will have some guest speakers who will discuss real-cases - Develop critical sense. **What this course is not about** - Cryptocurrencies - Hacking systems - Make money through cryptocurrencies - Mathematical aspects of cryptography **The Ledger** A ledger is a container which gathers every business transaction occurring for a given account. It generally contains the date and amount of the transaction. There are several ledgers, most notably, the Accounts Receivable Ledger and the Accounts Payable Ledger. The concept of ledger goes back to 1494 when mathematician Luca Pacioli first invented the double-entry bookkeeping accounting system. Plenty of accounts: assets, liabilities, capital, income, expenses... This system still functions today. The accounts are reported in the so called *balance sheet* and *income statement* (cash flows are reported in the CFS). There are several ledger formats, most notably the T-account and the three- or four-column ledger. Two concepts are fundamental to understand the Blockchain: 1. Thinking in Layers 2. Thinking about Blockchain as **software architecture**. 1. The metaphor: do you have a mobile phone? - How much do you know about the different wireless communication protocols that are used to send and receive data? - How much do you know about electromagnetic waves that are the foundation of mobile communication? - How can use your phone then? We use this approach all the time when we learn how to use a new technology. There is a problem though: these mental partitions are **highly individual**. This typically leads to **problems in communication**. Unifying the way of partitioning a system is the key point when discussing technology. **Application vs. Implementation Layers** Separating the user's needs from the technical internals of a system leads to a clear separation of the **application layer** from the **implementation layer**. Everything that belongs to the application layer is concerned with the user's needs (e.g., listening to music, taking photos, or booking hotel rooms). Everything that belongs to the implementation layer is concerned with making these things happen (e.g., converting digital information into acoustic signals, recognizing the color of a pixel in a digital camera, or sending messages over the Internet to a booking system). Elements of the implementation layer are technical by nature and are considered a mean to an end. **Functional vs. Nonfunctional Layers** Distinguishing between what a system does and how it does what is does leads to the separation of **functional** and **nonfunctional** aspects. Examples of functional aspects are sending data over a network, playing music, taking photos, and manipulating individual pixels of a picture. Examples of nonfunctional aspects are a beautiful graphical user interface, fast-running software, and an ability to keep user data private and safe. Other important nonfunctional aspects of a system are **security** and **integrity**. Integrity means that a **system behaves as intended**, and it involves many aspects such as security and correctness. **Let's layer the mobile phone...** ![[Bocconi/Bocconi - Introduction to Blockchain/Images - Bocconi Introduction to Blockchain/image1.png]] Functional aspects of the application layer serve obvious needs of the users. These elements are typically the ones users learn about. On the other hand, the nonfunctional aspects of the implementation layer are rarely seen as major elements of the system. **Integrity** Three 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**: The system is able to restrict access to its data and functionality to authorized users only. Everybody uses software everyday with great success. Everybody is pretty happy about it. We may change our feelings quite drastically the minute our interaction with the software fails or the software itself fails. On these occasions, we begin to realize that software integrity is a highly valuable commodity. Hence, it should not come as a surprise that software professionals spend a lot of their time working on this seemingly tiny nonfunctional aspect of their implementation layer. **Blockchain as a Software Architecture** The metaphor: Have you ever bought a car? Cars are equipped with different types of engines (e.g., diesel, gasoline, or electric engine). This is an example of the process of **modularization**, which is the result of applying the idea of layering to cars. Two cars that look identical from the outside can differ dramatically with respect to the power of their engines and hence have very different driving performance. Additionally, your choice of the engine will have an impact on other characteristics of the car, like its price, its operational costs, the type of fuel consumed, the exhaust system, and the dimensions of the brakes. **Layering a Payment System** ![[Bocconi/Bocconi - Introduction to Blockchain/Images - Bocconi Introduction to Blockchain/image2.png]] Why do we have a question mark? That's the "engine" of our system. In other words, it's the architecture of the system. **Hints on Software Architectures** There exist dozens of ways to implement software systems. One of the fundamental decisions we must take regards its architecture. An architecture is the way components are organized and related to one another. There are three major approaches: ![[Bocconi/Bocconi - Introduction to Blockchain/Images - Bocconi Introduction to Blockchain/image3.png]] - **Centralized** - Components are located around and connected with one central component. - Circles represent node while lines represent connections between nodes. - **Decentralized** - In decentralized systems, there are multiple central components. - Each central component is connected to another central component. - In this regards, a decentralized network is composed by multiple centralized networks. - **Distributed** - Components are connected with one another without having a central element. - None of the components is directly connected with all other components. - Though, all components are connected with one another at least with one indirect connection. **Pros of a Distributed System** - **Higher computing power**: The computing power of a distributed system is the result of combining the computing power of all connected computers. Hence, distributed systems typically have more computing power than each individual computer. This has been proven true even when comparing distributed systems comprised of computers of relatively low computing power with isolated super computers. - **Cost reduction**: The price of mainstream computers, memory, disk space, and networking equipment has fallen dramatically during the past 20 years. Since distributed systems consist of many computers, the initial costs of distributed systems are higher than the initial costs of individual computers. However, the costs of creating, maintaining, and operating a super-computer are still much higher than the costs of creating, maintaining, and operating a distributed system. This is particularly true since replacing individual computers of a distributed system can be done with no significant overall system impact. - **Higher reliability**: The increased reliability of a distributed system is based on the fact that the whole network of computers can continue operating even when individual machines crash. A distributed system does not have a single point of failure. If one element fails, the remaining elements can take over. Hence, a single super-computer typically has a lower reliability than a distributed system. - **Ability to grow naturally**: The computing power of a distributed system is the result of the aggregated computing power of its constituents. One can increase the computing power of the whole system by connecting additional computers with the system. As a result, the computing power of the whole system can be increased incrementally on a fine-grained scale. This supports the way in which the demand for computing power increases in many organizations. The incremental growth of distributed systems is in contrast to the growth of the computing power of individual computers. Individual computers provide identical power until they are replaced by a more powerful computer. This results in a discontinuous growth of computing power, which is only rarely appreciated by the consumers of computing services. **Cons of a Distributed System** - **Coordination overhead**: Distributed systems do not have central entities that coordinate their members. Hence, the coordination must be done by the members of the system themselves. Coordinating work among coworkers in a distributed system is challenging and costs effort and computing power that cannot be spent on the genuine computing task, hence, the term coordination overhead. - **Communication overhead**: Coordination requires communication. Hence, the computers that form a distributed system have to communicate with one another. This requires the existence of a communication protocol and the sending, receiving, and processing of messages, which in turn costs effort and computing power that cannot be spend on the genuine computing task, hence, the term communication overhead. - **Dependency on networks**: Any kind of communication requires a medium. The medium is responsible for transferring information between the entities communicating with one another. Computers in distributed systems communicate by means of messages passed through a network. Networks have their own challenges and adversities, which in turn impact the communication and coordination among computers that form a distributed system. However, without any network, there will be no distributed system, no communication, and therefore no coordination among the nodes, thus the dependency on networks. - **Higher program complexity**: Solving a computation problem involves writing programs and software. Due to the disadvantages mentioned previously, any software in a distributed system has to solve additional problems such as coordination, communication, and utilizing of networks. This increases the complexity of the software. - **Security issues**: Communication over a network means sending and sharing data that are critical for the genuine computing task. However, sending information through a network implies security concerns as untrustworthy entities may misuse the network in order to access and exploit information. Hence, any distributed system has to address security concerns. The less restricted the access to the network over which the distributed nodes communicate is, the higher the security concerns are for the distributed system. **Distributed Peer-to-Peer Systems (P2P)** P2P networks are a special kind of distributed systems. Each node shares its computing power over the network so that other nodes can exploit it. Each and every node has the exact same rights and roles in the system. All the nodes are both suppliers and consumers of resources. Lots of applications: file sharing, content distribution, privacy protection. **What about hybrid architectures?** There are pros and cons both for centralized and distributed networks. What if we combine them in an hybrid shape? These are just two examples of typical blockchain systems. ![[Bocconi/Bocconi - Introduction to Blockchain/Images - Bocconi Introduction to Blockchain/image4.png|500]] **How can we identify a distributed system?** The increasing diffusion of hybrid systems makes it hard to clearly and uniquely identify distributed systems. It is really hard to come up with a generally accepted definition of distributed system. Here is a trick: If you are in doubt whether or not a system is distributed, look for a single component (e.g., a database, a name or user registry, a login or logoff component, or an emergency switch-off button) that could terminate the whole system. If you find such a component, the system under consideration is not distributed.