Blockchain basics (classification, consensus, transactions, miner fees)

A blockchain is essentially a peer-to-peer distributed ledger database .

1. Blockchain classification:

A. Classified by participants: public chain, alliance chain, private chain

1. Public blockchains (Public blockchains) Public blockchains
        refer to areas that can be read by anyone in the world, anyone can send transactions and transactions can be effectively confirmed, and anyone can participate in the consensus process. Blockchain - The consensus process determines which blocks can be added to the blockchain and defines the current state. As an alternative to centralized or quasi-centralized trust, the security of the public blockchain is maintained by the "encrypted digital economy" - the "encrypted digital economy" adopts a workload proof mechanism or an equity proof mechanism to combine economic rewards and encrypted digital Validation is combined and follows a general principle: the economic reward that everyone gets from it is proportional to their contribution to the consensus process. These blockchains are often considered "completely decentralized".

2. Consortium blockchains: (Consortium blockchains) Consortium blockchains
        are blockchains whose consensus process is controlled by preselected nodes; for example, imagine a community of 15 financial institutions, each running a Nodes, and in order for each block to be valid, 10 of them need to be confirmed (2/3 confirmation). The blockchain may be readable by everyone, or limited to participants, or take a hybrid route, such as the root hash of the block and its API (application programming interface), which can be used by the outside world. Make a limited number of queries and obtain information about the state of the blockchain. These blockchains can be considered "partially decentralized".

3. Fully private blockchains

        A private blockchain is one whose write authority is in the hands of only one organization. Read permissions are either open to the outside world or restricted to any degree. Relevant applications include database management, auditing, and even a company, although in some cases it is desirable to have public auditability, but in many cases public readability is not necessary.

B. Classified by the relationship between chains: main chain, side chain

       Moreover, different blockchains can also form a network, and the chain and chain in the network are interconnected, resulting  in the concept of Interchain.

2. Consensus Mechanism

At present, there are mainly several types of consensus mechanisms: Pow, Pos, DPos, Pool, PBFT
1, Pow Proof of Work, which is familiar to everyone in mining. Through AND or operation, a random number that satisfies the rules is calculated, that is, to obtain this time Accounting right, send out the data that needs to be recorded in this round, and store it together with other nodes in the whole network after verification;
Advantages: Complete decentralization, nodes can enter and exit freely;
Disadvantages: At present, bitcoin has attracted most of the computing power in the world, and others use Pow consensus It is difficult for the blockchain application of the mechanism to obtain the same computing power to ensure its own security; mining causes a lot of waste of resources; the consensus cycle is long, which is not suitable for commercial applications Representative: Bitcoin

2, Pos proof of stake, an upgraded consensus mechanism of Pow; according to the proportion of tokens (quantity ratio) and time (coin age) occupied by each node; the mining difficulty is reduced in equal proportions, thereby speeding up Find the speed of random numbers. Advantages: To a certain extent, it shortens
the time for reaching consensus
Represents: Ethereum

3. The DPos share authorization proof mechanism is similar to voting by the board of directors. Token holders vote a certain number of nodes to act on their behalf for verification and accounting. More than 100 board members are elected, and more than 20 are selected from the board to mine in disguise, calculate packaged transactions, and then receive corresponding rewards.
Advantages: The number of nodes participating in verification and accounting can be greatly reduced, and consensus verification can be achieved in seconds.
Disadvantages: The entire consensus mechanism still relies on tokens, and many commercial applications do not need tokens. 代表:EOS

4、Pool验证池,基于传统的分布式一致性技术,加上数据验证机制;是目前行业链大范围在使用的共识机制
优点:不需要代币也可以工作,在成熟的分布式一致性算法(Pasox、Raft)基础上,实现秒级共识验证;
缺点:去中心化程度不如bictoin;更适合多方参与的多中心商业模式

5、
PBFT:Practical Byzantine Fault Tolerance,实用拜占庭容错算法。见前文拜占庭容错算法介绍。 
 PBFT是一种状态机副本复制算法,即服务作为状态机进行建模,状态机在分布式系统的不同节点进行副本复制。每个状态机的副本都保存了服务的状态,同时也实现了服务的操作。将所有的副本组成的集合使用大写字母R表示,使用0到|R|-1的整数表示每一个副本。为了描述方便,假设|R|=3f+1,这里f是有可能失效的副本的最大个数。尽管可以存在多于3f+1个副本,但是额外的副本除了降低性能之外不能提高可靠性。
在使用共识机制,保证数据一致性时的巨大优势(共识机制则是Ripple首先提出的,数据正确性优先的网络交易同步机制,在共识网络中,无论软件代码怎么变动,无法取得共识就无法进入网络,更不要提分叉了)

三、交易

   一笔交易是一个地址的虚拟货币转移到另一个地址 ;也可以是一次调用智能合约。

一笔交易的流程:
  1、交易的生成:所有者A利用他的私钥对前一次交易和下一位所有者B签署一个数字签名,
        并将这个签名附加在这枚货币的末尾,制作成交易单。

  2、交易的传播:A将交易单广播至全网,每个接单都会收到交易信息纳入一个区块中。

  3、工作量证明:每个节点通过相当于解一道数学题的工作量证明机制,得到创建区块的权利并且争取到数字货币的奖励。

  4、整个网络节点验证:当一个节点找到解时,它就像全网广播该区块记录的所有该时间戳,并由其它节点核对。

  5、记录到区块链:全网其它节点核对该区块记账的正确性,没有错误后他们将在该合法区块后竞争下一个区块,
        这样就形成了一个合法记账的区块链。

四、矿工费

       

 1、静态收益  :打包区块奖励,由于初始的货币数量固定,所以随着时间的推移,静态收益会越来越少。
                        如:比特币协议规定,挖到新区块的矿工将获得奖励,一开始(2008年)是50个比特币,然后每4年减半,
                        目前(2018年)是12.5个比特 币。这也是比特币的供给增加机制,流通中新增的比特币都是这样诞生的。                                           每4年奖励减半,由于比特币可以分割到小数点后八位,那么到了2140年,矿工将得不到任何奖励,
                         比特币的数量也将停止增加。这时,矿工的收益就完全依靠交易手续费了
  2、动态收益  :  交易手续费
               所谓交易手续费,就是矿工可以从每笔交易抽成,具体的金额由支付方自愿决定。你完全可以一毛不拔,
                 一分钱也不给矿工,但是那样的话,你的交易就会没人处理,迟迟无法写入区块链,得到确认。
                         矿工们总是优先处理手续费最高的交易。  
(以太坊为例:一笔交易消耗Gas数量为固定值,但Gas的价格是由交易提交人决定)

    



Guess you like

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