当前位置:主页 > 资料 >

Blockchains from the ground up
栏目分类:资料   发布日期:2017-05-28   浏览次数:

导读:本文为去找网小编(www.7zhao.net)为您推荐的Blockchains from the ground up,希望对您有所帮助,谢谢! Blockchains from the ground up: Part1 Using a scenario that begins with the exchange of apples for oranges, understa

本文为去找网小编(www.7zhao.net)为您推荐的Blockchains from the ground up,希望对您有所帮助,谢谢! copyright www.7zhao.net



Blockchains from the ground up: Part 1

Using a scenario that begins with the exchange of apples for oranges, understand the essential concepts and advantages of blockchains.

本文来自去找www.7zhao.net

By John Mathews

本文来自去找www.7zhao.net

May 25 2017

本文来自去找www.7zhao.net

How to maintain a reliable list across a small network without a central authority

This is part 1 of an introduction to the key features of a generalised blockchain. I haven’t included references to Bitcoin or any particular digital currencies or blockchain implementations. This is because a digital currency is just one application of blockchain technology. 内容来自www.7zhao.net

Create a financial document that cannot be forged or disputed

Let’s imagine there is a village somewhere where people still trade by bartering. John has some apples whilst Lizzie has some oranges. John would like an orange, and offers Lizzie an apple in exchange. She accepts, and writes John a receipt. www.7zhao.net

Date: 1234
From: Lizzie
To: John    
What: 1 Orange  
Price: 1 Apple   内容来自www.7zhao.net 

So far, so good. The receipt is evidence of the transaction. The next day John wants an orange but doesn’t have anything to exchange. He offers to write Lizzie a note saying he owes Lizzie 1 orange (an ). They think about this and agree that John should sign the note so that Lizzie can prove that John owes her 1 orange. 内容来自www.7zhao.net

Date: 1234
From: John
To: Lizzie
What: 1 Orange
Signed: John's signature, Lizzie's signature 本文来自去找www.7zhao.net 

This IOU is a nice gesture, but it’s simple to forge. Lizzie has the only copy of the IOU and once Lizzie has seen Johns signature, she could easily copy it and create more IOU ’s. She could also change this IOU from 1 orange to 11 oranges (for example) and John couldn’t prove what the original amount was. If Lizzie and John disagreed over what was owed it would be impossible to know who was telling the truth. Its one persons word against the other. 内容来自www.7zhao.net

Lizzie realises this and suggests an improvement - they will find a witness and make 3 copies of the IOU . Each copy will be signed by Lizzie, John and the Witness. Lets call this witness “Walter”. 内容来自www.7zhao.net

Date: 1234
From: John
To: Lizzie
What: 1 Orange
Witness: Walter
Signed: "John's signature", "Lizzie's signature", "Walter's signature""" www.7zhao.net 

This is a much stronger document and is more difficult to forge. If Lizzie changes the “What:” to “11 Oranges”, both John and Walter will have copies of the original with her signature on it. It will be 2 pieces of evidence against Lizzie’s 1. Lizzie will be laughed out of court. Hahaha. 本文来自去找www.7zhao.net

3 Party transactions work pretty well, and this is how most transactions are recorded today. But there is a weakness: If Lizzie can bribe Walter then the transaction can be falsified! John would rely on Walter to verify his version of the transaction but would be let down by Walters lack of integrity. Lizzie and Walter could change 1 orange to 11 oranges and if Lizzie offered Walter some of the extra oranges this would give them both an incentive to forge the documentation. If Walter liked oranges enough, he might not care that his career as a witness will be ruined. 去找(www.7zhao.net欢迎您

This is a problem for modern financial systems and a great deal of time, money and regulation is devoted to trying to ensure that third parties are trustworthy. E.g. If I buy a car and my bank is in cahoots with the car dealership, I could be defrauded. Reducing this risk to an acceptably low level makes financial services slower and more expensive than they would otherwise need to be. 内容来自www.7zhao.net

The solution is (which is introduced in myprevious post). In this system, each individual generates their own public-private key pair. They keep their private key private and make their public key freely available. A detailed description of public-key cryptography is out of scope for this post, but briefly: 去找(www.7zhao.net欢迎您

A public key is derived from a private key, and this pair together have a set of unique mathematical properties. Either key can be used to encrypt a message but only the other key can be used to decrypt it. You cannot use the same key to encrypt and decrypt a message. If the private key is used to encrypt then anybody can decrypt (because the public key is publicly available) and whilst this is clearly a terrible way to keep a secret it’s a great way to verify who encrypted the message, because only one person has the private key. Because of this, using a private key to encrypt a message is effectively creating a digital signature which cannot be forged. (If the public key is used to encrypt a message then only the private key can be used to decrypt it, and this approach is used to transfer secret data securely). www.7zhao.net

Back to the fruit. If Lizzie wants to accept Johns IOU she can use public-key cryptography and no-one needs to worry about Walter. There are 3 steps to the transaction. 内容来自www.7zhao.net

1] Create the IOU stating that John owes Lizzie 1 orange. 去找(www.7zhao.net欢迎您

Date: 1234 From: John To: Lizzie What: 1 Orange 

去找(www.7zhao.net欢迎您

2] John creates a public private key pair and adds a line of text to the IOU which he encrypts using his private key.

本文来自去找www.7zhao.net

Date: 1234, From: John, To: Lizzie, What: 1 Orange
"Signed by John" <- John encrypts this line using his private key 

copyright www.7zhao.net

3] John makes his public key freely available to anyone who wants it. 去找(www.7zhao.net欢迎您

This will work because anybody (not just Lizzie) can check that John signed the IOU . The transaction can be verified by looking at the “From” part of that transaction, noticing that this transaction is supposedly from John and then using John’s public key to decrypt the encoded “signature” line. 欢迎访问www.7zhao.net

The signature can only be decrypted using John’s public key if his private key was used to encrypt it. Because John is the only person with his private key, that proves the transaction is valid, and Lizzie isn’t dishonestly creating a debt for John to pay. 内容来自www.7zhao.net

Clearly if John discloses his private key (or its stolen) then he will make the system insecure, but this is a problem with John and his security protocols, not with public-key cryptography. www.7zhao.net

Create and maintain an accurate list of transactions

So far we’ve seen how 1 IOU (for an orange) can be securely created, signed and verified. This process can extended to be used by more people to exchange more fruit. For example. 欢迎访问www.7zhao.net

The original note:

本文来自去找www.7zhao.net

Date: 1234, From: John, To: Lizzie, What: 1 Orange //  "Signed and encrypted by John using his private key"  
欢迎访问www.7zhao.net

Then some additional transactions: 内容来自www.7zhao.net

Date: 1235, From: Lizzie, To: John, What: 2 Apples //  "Signed and encrypted by Lizzie using her private key" 
Date: 1236, From: John, To: Chris, What: 1 Banana //  "Signed and encrypted by John using his private key" 
Date: 1237, From: Chris, To: Lizzie, What: 2 Bananas //  "Signed and encrypted by Chris using his private key"  欢迎访问www.7zhao.net 

After these 4 transactions, between John, Chris and Lizzie, this is what each person owes: www.7zhao.net

  • John owes 1 orange to Lizzie and 1 banana to Chris
  • Lizzie owes 2 apples to John
  • Chris owes 2 bananas to Lizzie.

This is confusing, (and ridiculous). It is not possible to know who is the most in debt or who is the most wealthy. Lizzie owes 2 apples, but is owed 2 bananas and 1 apple. Does that mean her fruit business is losing money or making money? We cannot say. To be able to know we need to use the same unit of value for all the fruits. Lets say that an orange is worth 2 apples, and a banana is also worth 2 apples (therefore 1 banana = 1 orange.), also lets invent a currency called “coins” and say 1 apple is worth 1 coin. The 4 transactions can now be rewritten as:

去找(www.7zhao.net欢迎您

Date: 1234, From: John, To: Lizzie, What: 2 coins //  "Signed and encrypted by John using his private key" 
Date: 1235, From: Lizzie, To: John, What: 2 coins //  "Signed and encrypted by Lizzie using her private key" 
Date: 1236, From: John, To: Chris, What: 2 coins //  "Signed and encrypted by John using his private key" 
Date: 1237, From: Chris, To: Lizzie, What: 4 coins //  "Signed and encrypted by Chris using his private key"  

欢迎访问www.7zhao.net

By going through the list of transactions we can see that: copyright www.7zhao.net

  • John owes Lizzie and Chris 2 coins each, and is owed 2 coins from Lizzie. His net amount is -2
  • Lizzie owes John 2 coins but is owed 4 coins from Chris. Her net amount is +2
  • Chris owes Lizzie 4 coins but is owed 2 coins from John. His net amount is -2

So far Lizzie is the only person who appears to have any business skills. www.7zhao.net

What if Lizzie wanted to use the 4 coins that she is owed by Chris to buy something from John? Could she use this system to transfer Chris’ promise to pay her 4 coins so that Chris would pay John instead? Yes, because everyone can trust that the record of the transactions is accurate and authentic, a debt can be used as payment. Lizzie’s transaction would look like this:

www.7zhao.net

Date: 1235, From: Lizzie, To: John, What: ba781... //  "Signed and encrypted by Lizzie using her private key" 
copyright www.7zhao.net

The “What” section contains a of the original transaction (with Chris) that she wants to transfer to John. A hash is the signature for a file or some text and in this case it is the signature for Lizzie’s transaction with Chris. The signature is unique to each transaction and identifies which transaction is being used as payment. Because both transactions are signed using Lizzie’s private key, it is simple to verify that Lizzie has the right to use this previous transaction where she is owed (or paid) some coins as payment to another person. copyright www.7zhao.net

This shows how public-private key infrastructure can be used to securely record transactions and enable trade between a group of people, - under certain conditions. Blockchains can be used to transfer units of value like in this example, but we could just as easily put selfies or certificates of ownership (for houses, financial instruments, diamonds, etc) inside the “What” part of the transaction. If we make two other changes - removing the “To” part of the transaction, and including a hash of the transaction as part of the text which is signed using a private key. If we do this, then a record would be: 内容来自www.7zhao.net

Date: 2345, From: Chris, What: "A photo of me" //  "Transaction hash: d6f18..., Signed and encrypted by Chris using his private key"  

copyright www.7zhao.net

This would create a reliable record of what Chris claims he looks like. He can confidently send anyone this record and if they have his public key then they can verify that it is Chris himself who signed it and is asserting that the photo is him. If somebody changed the photo then the data in the transaction would change and the transaction will have a new hash value. The new hash value will not match the hash value contained within the signature, and the text in the signature cannot be changed because it can only be encrypted using Chris’ private key, which only Chris has. Therefore it will be simple to show that someone other than Chris is trying to change the photo.

去找(www.7zhao.net欢迎您

Another use for public-key cryptography arises if Chris were an employee in a bank, and the “What” contained documents about a customer the bank is providing financial services for. In this scenario, Chris (representing the bank) is effectively confirming the customer’s true identity and documenting the evidence that’s been collected to show that the bank knows who their customer really is. If the transaction included a new section called “Customer ID ” (for example) then a database of all customers whose identity checks have been successfully completed can be made. This can be shared with other departments (or banks) easily and immutably. This is the concept behind KYC on a blockchain.

本文来自去找www.7zhao.net

Back to our fruit traders: At the moment a participant is allowed to carry a net negative balance. For this system to work in reality, the creation of “coins” will need to be controlled in order to maintain their value. In the example above, people can freely create “coins” and can also carry negative amounts of “coins”. This would result in the value of a “coin” plummeting. Therefore their creation (and conversion from fruit) must be controlled in a predictable manner. 去找(www.7zhao.net欢迎您

Our examples so far only include 3 people. If there are a lot of people in the network it wouldn’t be feasible to insist that everyone is present or online each time a new transaction is added to the list (the chain) of transactions. However if we allow transactions to be added whilst some people are offline we create an opportunity for fraud. The reasons why, and the solution to this and other problems will be described in part 2. 去找(www.7zhao.net欢迎您

Thanks for reading! If you'd like to know when I publish something new, pleasesubscribe! www.7zhao.net

copyright www.7zhao.net


本文原文地址:http://johnmathews.eu/blockchain-introduction.html

以上为Blockchains from the ground up文章的全部内容,若您也有好的文章,欢迎与我们分享!

copyright www.7zhao.net

Copyright ©2008-2017去找网版权所有   皖ICP备12002049号-2 皖公网安备 34088102000435号   关于我们|联系我们| 免责声明|友情链接|网站地图|手机版