github.com/kchristidis/fabric@v1.0.4-0.20171028114726-837acd08cde1/docs/source/blockchain.rst (about) 1 Introduction 2 ============ 3 Hyperledger Fabric is a platform for distributed ledger solutions underpinned 4 by a modular architecture delivering high degrees of confidentiality, 5 resiliency, flexibility and scalability. It is designed to support pluggable 6 implementations of different components and accommodate the complexity and 7 intricacies that exist across the economic ecosystem. 8 9 Hyperledger Fabric delivers a uniquely elastic and extensible architecture, distinguishing 10 it from alternative blockchain solutions. Planning for the future of enterprise 11 blockchain requires building on top of a fully vetted, open-source architecture; 12 Hyperledger Fabric is your starting point. 13 14 We recommended first-time users begin by going through the rest of the 15 introduction below in order to gain familiarity with how blockchains work 16 and with the specific features and components of Hyperledger Fabric. 17 18 Once comfortable -- or if you're already familiar with blockchain and 19 Hyperledger Fabric -- go to :doc:`getting_started` and from there explore the 20 demos, technical specifications, APIs, etc. 21 22 What is a Blockchain? 23 --------------------- 24 **A Distributed Ledger** 25 26 At the heart of a blockchain network is a distributed ledger that records all 27 the transactions that take place on the network. 28 29 A blockchain ledger is often described as **decentralized** because it is replicated 30 across many network participants, each of whom **collaborate** in its maintenance. 31 We’ll see that decentralization and collaboration are powerful attributes that 32 mirror the way businesses exchange goods and services in the real world. 33 34 .. image:: images/basic_network.png 35 36 In addition to being decentralized and collaborative, the information recorded 37 to a blockchain is append-only, using cryptographic techniques that guarantee 38 that once a transaction has been added 39 to the ledger it cannot be modified. This property of immutability makes it 40 simple to determine the provenance of information because participants can be 41 sure information has not been changed after the fact. It’s why blockchains 42 are sometimes described as **systems of proof**. 43 44 **Smart Contracts** 45 46 To support the consistent update of information – and to enable a whole host of 47 ledger functions (transacting, querying, etc) – a blockchain network uses **smart 48 contracts** to provide controlled access to the ledger. 49 50 .. image:: images/Smart_Contract.png 51 52 Smart contracts are not only a key mechanism for encapsulating information 53 and keeping it simple across the network, they can also be written to allow 54 participants to execute certain aspects of transactions automatically. 55 56 A smart contract can, for example, be written to stipulate the cost of shipping 57 an item that changes depending on when it arrives. With the terms agreed to 58 by both parties and written to the ledger, the appropriate funds change hands 59 automatically when the item is received. 60 61 **Consensus** 62 63 The process of keeping the ledger transactions synchronized across the network – 64 to ensure that ledgers only update when transactions are approved by the appropriate 65 participants, and that when ledgers do update, they update with the 66 same transactions in the same order – is called **consensus**. 67 68 .. image:: images/consensus.png 69 70 We’ll learn a lot more about ledgers, smart contracts and consensus later. For 71 now, it’s enough to think of a blockchain as a shared, replicated transaction 72 system which is updated via smart contracts and kept consistently 73 synchronized through a collaborative process called consensus. 74 75 Why is a Blockchain useful? 76 --------------------------- 77 78 **Today’s Systems of Record** 79 80 The transactional networks of today are little more than slightly updated 81 versions of networks that have existed since business records have been kept. 82 The members of a **Business Network** transact with each other, but they maintain 83 separate records of their transactions. And the things they’re transacting – 84 whether it’s Flemish tapestries in the 16th century or the securities of today 85 – must have their provenance established each time they’re sold to ensure that 86 the business selling an item possesses a chain of title verifying their 87 ownership of it. 88 89 What you’re left with is a business network that looks like this: 90 91 .. image:: images/current_network.png 92 93 Modern technology has taken this process from stone tablets and paper folders 94 to hard drives and cloud platforms, but the underlying structure is the same. 95 Unified systems for managing the identity of network participants do not exist, 96 establishing provenance is so laborious it takes days to clear securities 97 transactions (the world volume of which is numbered in the many trillions of 98 dollars), contracts must be signed and executed manually, and every database in 99 the system contains unique information and therefore represents a single point 100 of failure. 101 102 It’s impossible with today’s fractured approach to information and 103 process sharing to build a system of record that spans a business network, even 104 though the needs of visibility and trust are clear. 105 106 **The Blockchain Difference** 107 108 What if instead of the rat’s nest of inefficiencies represented by the “modern” 109 system of transactions, business networks had standard methods for establishing 110 identity on the network, executing transactions, and storing data? What 111 if establishing the provenance of an asset could be determined by looking 112 through a list of transactions that, once written, cannot be changed, and can 113 therefore be trusted? 114 115 That business network would look more like this: 116 117 .. image:: images/future_net.png 118 119 This is a blockchain network. Every participant in it has their own replicated 120 copy of the ledger. In addition to ledger information being shared, the processes 121 which update the ledger are also shared. Unlike today’s systems, where a 122 participant’s **private** programs are used to update their **private** ledgers, 123 a blockchain system has **shared** programs to update **shared** ledgers. 124 125 With the ability to coordinate their business network through a shared ledger, 126 blockchain networks can reduce the time, cost, and risk associated with private information and 127 processing while improving trust and visibility. 128 129 You now know what blockchain is and why it’s useful. There are a lot of other 130 details that are important, but they all relate to these fundamental ideas of 131 the sharing of information and processes. 132 133 What is Hyperledger Fabric? 134 --------------------------- 135 136 The Linux Foundation founded Hyperledger in 2015 to advance 137 cross-industry blockchain technologies. Rather than declaring a single 138 blockchain standard, it encourages a collaborative approach to developing 139 blockchain technologies via a community process, with intellectual property 140 rights that encourage open development and the adoption of key standards over 141 time. 142 143 Hyperledger Fabric is one of the blockchain projects within Hyperledger. 144 Like other blockchain technologies, it has a ledger, uses smart contracts, 145 and is a system by which participants manage their transactions. 146 147 Where Hyperledger Fabric breaks from some other blockchain systems is that 148 it is **private** and **permissioned**. Rather than an open permissionless system 149 that allows unknown identities to participate in the network (requiring protocols 150 like Proof of Work to validate transactions and secure the network), the members 151 of a Hyperledger Fabric network enroll through a **Membership Service Provider (MSP)**. 152 153 Hyperledger Fabric also offers several pluggable options. Ledger data can be 154 stored in multiple formats, consensus mechanisms can be switched in and out, 155 and different MSPs are supported. 156 157 Hyperledger Fabric also offers the ability to create **channels**, allowing a group of 158 participants to create a separate ledger of transactions. This is an especially 159 important option for networks where some participants might be competitors and not 160 want every transaction they make - a special price they're offering to some participants 161 and not others, for example - known to every participant. If two 162 participants form a channel, then those participants – and no others – have copies 163 of the ledger for that channel. 164 165 **Shared Ledger** 166 167 Hyperledger Fabric has a ledger subsystem comprising two components: the **world 168 state** and the **transaction log**. Each participant has a copy of the ledger to 169 every Hyperledger Fabric network they belong to. 170 171 The world state component describes the state of the ledger at a given point 172 in time. It’s the database of the ledger. The transaction log component records 173 all transactions which have resulted in the current value of the world state. 174 It’s the update history for the world state. The ledger, then, is a combination 175 of the world state database and the transaction log history. 176 177 The ledger has a replaceable data store for the world state. By default, this 178 is a LevelDB key-value store database. The transaction log does not need to be 179 pluggable. It simply records the before and after values of the ledger database 180 being used by the blockchain network. 181 182 **Smart Contracts** 183 184 Hyperledger Fabric smart contracts are written in **chaincode** and are invoked 185 by an application external to the blockchain when that 186 application needs to interact with the ledger. In most cases chaincode only 187 interacts with the database component of the ledger, the world state (querying 188 it, for example), and not the transaction log. 189 190 Chaincode can be implemented in several programming languages. The currently 191 supported chaincode language is `Go <https://golang.org/>`__ with support 192 for Java and other languages coming in future releases. 193 194 **Privacy** 195 196 Depending on the needs of a network, participants in a Business-to-Business 197 (B2B) network might be extremely sensitive about how much information they share. 198 For other networks, privacy will not be a top concern. 199 200 Hyperledger Fabric supports networks where privacy (using channels) is a key 201 operational requirement as well as networks that are comparatively open. 202 203 **Consensus** 204 205 Transactions must be written to the ledger in the order in which they occur, 206 even though they might be between different sets of participants within the 207 network. For this to happen, the order of transactions must be established 208 and a method for rejecting bad transactions that have been inserted into the 209 ledger in error (or maliciously) must be put into place. 210 211 This is a thoroughly researched area of computer science, and there are many 212 ways to achieve it, each with different trade-offs. For example, PBFT (Practical 213 Byzantine Fault Tolerance) can provide a mechanism for file replicas to 214 communicate with each other to keep each copy consistent, even in the event 215 of corruption. Alternatively, in Bitcoin, ordering happens through a process 216 called mining where competing computers race to solve a cryptographic puzzle 217 which defines the order that all processes subsequently build upon. 218 219 Hyperledger Fabric has been designed to allow network starters to choose a 220 consensus mechanism that best represents the relationships that exist between 221 participants. As with privacy, there is a spectrum of needs; from networks 222 that are highly structured in their relationships to those that are more 223 peer-to-peer. 224 225 We’ll learn more about the Hyperledger Fabric consensus mechanisms, which 226 currently include SOLO, Kafka, and will soon extend to SBFT (Simplified 227 Byzantine Fault Tolerance), in another document. 228 229 Where can I learn more? 230 ----------------------- 231 232 :doc:`getting_started` 233 234 We provide a number of tutorials where you’ll be introduced to most of the 235 key components within a blockchain network, learn more about how they 236 interact with each other, and then you’ll actually get the code and run 237 some simple transactions against a running blockchain network. We also provide 238 tutorials for those of you thinking of operating a blockchain network using 239 Hyperledger Fabric. 240 241 :doc:`fabric_model` 242 243 A deeper look at the components and concepts brought up in this introduction as 244 well as a few others and describes how they work together in a sample 245 transaction flow. 246 247 .. Licensed under Creative Commons Attribution 4.0 International License 248 https://creativecommons.org/licenses/by/4.0/