Blockchain Study Notes (1)

I have recently started to learn the knowledge of blockchain, and use articles to record my learning process, while summarizing the articles for beginners. If there is anything wrong with my understanding, I hope you will correct me.

In addition, I would like to recommend to you the materials I am using.

1. Blockchain - from digital currency to credit society

2. Bitcoin White Paper

3. Proof of Stake White Paper

To learn the blockchain, you need to constantly check the information yourself, where you won't check it, but I hope you don't get too obsessed with the concept of a certain word, sometimes it's a matter of course~

I hope to make progress with everyone here. Without further ado, let's enter the theme

One: What is blockchain?

   Simply put, a blockchain is a shared decentralized distributed database with the following characteristics:

        1. Open and transparent

        2. Decentralization

        3. Anonymity

        4. Information cannot be tampered with

        5. No trust cost

We illustrate the above features with an example;

For example, recall your process for buying a book online:

  1. The first step, you place an order and send the money to Alipay ;
  2. The second step is to notify the seller that the goods can be shipped after Alipay receives the payment;
  3. The third step, the seller will ship the goods to you after receiving the Alipay notification;
  4. The fourth step, after you receive the book, feel satisfied, choose to confirm receipt on Alipay ;
  5. The fifth step, Alipay receives the notification and sends the money to the seller. Process ends.

            You will find that although you are dealing with the seller, all the key processes are dealing with Alipay. The advantage of this is that if there is a problem in any link, both the seller and the buyer can seek help through Alipay and let Alipay arbitrate. This is the simplest transaction model based on centralized thinking. Its value is significant. It is to establish authority, gain the trust of multiple parties through authoritative endorsement, and at the same time rely on the capital and technical strength behind the authoritative party to ensure the reliability and security of data.
The above is a typical centralized transaction model. Its benefits are obvious. If there is a problem in any link, we can find Alipay for arbitration.
            But there are also the following disadvantages:
            1. Too much reliance on Alipay for secured transactions. If there is any problem with Alipay, we are powerless to resist. This problem is easy to understand. Imagine the "911" incident. If a centralized institution you rely on happens to be in the Pentagon, maybe you have just completed the transfer, and the institution that guaranteed you is no longer there. At this time, why not bear it for you? The loss, or whether to admit your transaction or not, is entirely up to the third party.
               2. During the transaction process, privacy is leaked. Alipay has no privacy in all account information through our transactions.

            So what does a transaction look like in the blockchain world?
                In the first step, you place an order and send the money to the seller;           
                In the second step, you record this transfer information in your account book;            
                The third step, you broadcast this transfer information;           
                In the fourth step, the seller and other members of the system will record this information on their own ledger           
                The fifth step, the seller ships the goods and records the fact of the delivery in their own account books            
                The sixth step, the seller broadcasts this fact record;           
                The seventh step, you and other members receive this fact record and record it on their own account books;            
                In the eighth step, you receive the books. At this point, the transaction process is over.
          First, we can find that in this model, there is no guarantor, and all the members that make up the system are notaries. All transaction information is open, transparent and safe and reliable. After the transaction is completed, the transaction is recorded on the ledgers of you, the seller, and other members. In other words, all members of the network have a shared ledger. And this ledger can be understood as a blockchain.
          Of course, we still have a lot of questions left unexplained.
          1. How to ensure that everyone can accurately receive the message sent by the sending node? What if there are malicious nodes in the network and the message is tampered with?
          2. Why do others keep accounting for you? Don't ledgers need money? Doesn't it take effort to keep accounts?
          3. And why is it anonymous? If anonymous, how to verify the correctness of the message sent?

   Before solving the above three problems, let me talk about my current understanding of the blockchain workflow. If there is something wrong, I hope you can correct me.
   First of all, the block exists in the node, and the blocks in the node are connected into a chain by timestamps, which is the blockchain.
           When a transaction is generated, the sending node broadcasts the new data record to the entire network.
           Then the receiving node verifies the received data information record information, and after the verification, the data record is incorporated into a block. For example, Zhang San transferred 100 yuan to Li Si, and Zhang San, as the sending node, will broadcast the message record "Zhang San transferred 100 yuan to Li Si" to the whole network, and other receiving nodes will verify whether the message record is Legal, such as whether the message was sent by Zhang San himself, whether Zhang San’s account has 100 yuan, and so on. After the verification is completed, the transaction record will be packaged into a block.
           Then, all receiving nodes in the entire network perform a consensus algorithm on this block (Proof of Work, Proof of Stake, etc.), which is actually Bitcoin mining.
           Finally, after the block passes the consensus algorithm, it is stored in the blockchain and added to the back of the previous block to form a chain.
            The above is my rough understanding of the whole process, I hope you can correct me!
   

   OK, now let's go back to the previous question:

      1. How to ensure that everyone can accurately receive the message sent by the sending node? What if there are malicious nodes in the network and the message is tampered with?

           To explain this problem, we have to mention the Byzantine general problem. The author will not say much about the description of the specific problem. The essence of the problem of Byzantine generals can be understood as how to resist the negative impact of interference factors (traitors) in a distributed system and ensure the consistency and correctness of message delivery. .

Only two conclusions about the solution to this problem are briefly mentioned here. For details, please refer to the following link: http://www.8btc.com/baizhantingjiangjun

         One: Oral agreement

            First, we define what an oral agreement is. We call a way of meeting the following three conditions an oral agreement:

            A1: Every message sent can be delivered correctly

            A2: The recipient of the message knows who sent the message

            A3: Be able to know the missing message

            In short, the channel is absolutely credible and the source is known. Note, however, that a verbal agreement does not tell who the last source of the message was.        

        Two: Written agreement:

        A written agreement is an oral agreement with the addition of the following two conditions

    (a) The signature is unforgeable and can be discovered once tampered with, and a traitor's signature can be forged by other traitors;

    (b) Anyone can verify the authenticity of the signature.

        In short, sources are traceable and verifiable

       We assume that the total number of nodes is m, and the number of rebel nodes is n. Under the algorithm of verbal agreement, at least m>3n Byzantine generals problem must be guaranteed to be solvable.

       Under the written agreement algorithm, as long as the sufficiency of the message exchange is ensured, and the number of signatures is assumed to be k, the problem can be solved when k>=m.

       另外大家注意,以上两种解法并不能真正解决拜占庭将军问题,我们没有考虑消息发送的并发性,真正解决这个问题的是区块链,它为发送信息加入了成本,降低了信息传递的速率,并加入了一个随机元素以保证在一个时间只有一个城邦可以进行广播,这个就是工作量证明。

        具体请大家参考之前的链接,笔者只是在为大家划重点~

        2.为什么别人会给你记账?难道账本不要钱?记账不需要花费精力吗?

 以比特币为例解释这个问题。首先我们来看中本聪比特币白皮书中的一段话:

我们约定如此:每个区块的第一笔交易进行特殊化处理,该交易产生一枚由该区块创造者拥有的新的电子货币。这样就增加了节点支持该网络的激励,并在没有中央集权机构发行货币的情况下,提供了一种将电子货币分配到流通领域的一种方法。这种将一定数量新货币持续增添到货币系统中的方法,非常类似于耗费资源去挖掘金矿并将黄金注入到流通领域。此时,CPU的时间和电力消耗就是消耗的资源。另外一个激励的来源则是交易费(transaction fees)。如果某笔交易的输出值小于输入值,那么差额就是交易费,该交易费将被增加到该区块的激励中。

        看完这段话,可能你脑海里会浮现两个字,挖矿。是的,文中的激励,就是对记账者的酬劳,挖矿,实际上就是在争夺记账的权力。
         3.还有为什么具有匿名性?如果匿名,怎么验证消息发送的正确性?
      这个问题其实就是数字签名怎么实现的问题。
        要解释这个问题首先得了解一个概念:
        非对称加密技术
        非对称加密技术,我们只要知道,每个人都拥有两把钥匙,一把私钥,一把公钥,私钥只有拥有者自己知道,而公钥是可以公开的,通过私钥加密的数据,只有对应的公钥可解,私钥自身不可解。
         比特币转账,需要先将该交易进行数字摘要,缩短成一段字符串,然后用自己的私钥对摘要进行加密,形成数字签名。完成后,你需要将原文(交易信息)和数字签名一起广播给矿工,矿工用你的公钥进行验证,如果验证成功,说明该笔交易确实是你发出的,且信息未被更改。这个过程中不需要你提供身份信息之类的。

文中很多东西可能说的比较模糊,如果有和我一样的正在自学的朋友,希望可以多多交流心得,如果有什么错误,希望大神们不吝赐教!~

    









Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736932&siteId=291194637