区块链的基本概念和原理

访客 阅读:20 2024-07-12 11:20:16 评论:0
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

区块链作为继大数据、云计算、人工智能等技术之后,是又一门当今市场下的热门技术,从17年火热起来后,一直是各大厂和有关区块链公司积极布局的方向之一,区块链人才因其稀缺也是各方必抢的资源。作者有幸这段时间的清闲,又可以很happy的写文章了。ps:貌似在本简书上第一篇就立下豪言要写一篇有关这方面的文章。(捂脸)

As a follow-up to technology such as big data, cloud computing, and artificial intelligence, the block chain, which has been one of the most popular technologies in today’s market since 17 years of hotness, has been one of the main factories and related block chain companies that, because of their scarcity, are the resources that are necessary for each party. The author is fortunate to be free for this time, and he can be very happy to write.

作者有幸在16年夏天加入一家区块链公司学习和研究区块链技术,算是最早的一批接触区块链领域的人,遗憾的是因为各方面原因,17年离开了。之后的两年各种区块链创业公司成立,人人都谈区块链、比特币、炒币,就连央行都在积极部署区块链,区块链也被列为国家新性技术产业规划。

The author had the privilege of joining a block chain company in the summer of 16 years to study and study block chain technology, which was the first group of people to come into contact with the block chain, and unfortunately left for 17 years for various reasons. The following two years, with the establishment of various block chain start-ups, everyone talked about block chains, bitcoins, and coins, even the central bank was actively deploying the block chain, which was listed as the country’s new technology industry plan.

本篇不是关于区块链的专业论文,仅作为区块链的入门和普及知识,若想对区块链技术有更深一步的认识,你需要加入一家区块链公司去具体实践。

This is not a professional paper on block chains. It serves only as an introduction to and popularization of block chains. If you are to have a deeper understanding of block chain technology, you need to join a block chain company in practice.


思维导图

一、区块链的本质、原理

区块链(Blockchain)是指通过去中心化和去信任的方式集体维护一个可靠数据库的技术方案。

Block chain (Blockchain) refers to a technical programme for the collective maintenance of a reliable database through decentralisation and detrust.

什么叫去中心化?例如公司里有服务器,所有的数据都存储在服务器上,或者云服务器上,那么这就是一个中心化的系统。又例如公司账务结算,通过银行汇入和汇出,那么银行就是充当中心化的这么一个角色。去中心化就是要消除中心化这么一个角色,那么有人会问,没有了服务器这样一种存储数据的媒介,数据是如何存储和交换的呢?

What does decentralisation mean? For example, there are servers in the company, and all the data are stored on the server, or on the cloud server, so this is a centralised system. And, for example, corporate accounting settlements, transfer and transfer through banks, banks play a central role. Decentralization is to decentralize this role, so one would ask how data is stored and exchanged without a server as a medium for storing data.

二、区块链的运行

(1)节点

在区块链系统中,节点是组成区块链的基本单元。在有些区块链系统中,任何加入区块链的设备,比如手机、PC、电子设备都可以是一个节点。

In block chain systems, nodes are the basic units that form the block chain. In some block chain systems, any device that joins the block chain, such as mobile phones, PCs, electronic devices, can be a node.

节点分为验证节点和非验证节点。验证节点就是指参与共识的一些节点,非验证节点就是无共识权限的节点。什么是共识?

Nodes are divided into validation nodes and non-verification nodes. Validation nodes refer to points participating in consensus, and non-verification nodes are nodes without consensus authority. What is consensus?

(2)共识算法

有了节点和共识节点,那么就要有一套算法,按照这个算法去验证交易的合法性,防止恶意交易。就好比选举总统,人人都有选举权,那么选举候选人当总统就必须有一套章程,是按照票数最高的人当总统,还是按照州投票数最高的候选人当总统,这就是一套共识算法。按照这套章法选举出来的总统是公正的,不可抵赖。同样的,共识节点通过一套共识算法而产生的区块是不可更改,不可逆的。所以区块链上的数据一旦生成和记录,就不可以修改。这样就可以保证数据的合法性,并且公开,透明。

With nodes and nodes of consensus, there will be an algorithm to verify the legitimacy of the transaction and to prevent bad-faith transactions. As with the election of the president, everyone has the right to vote, the election of a candidate to the presidency would require a set of by-laws, based on the highest number of votes, or the highest number of candidates to vote in the state, which is a consensus algorithm. The election of a president under this code is fair and indefensible.

共识算法的种类:PBFT、PoW、Pos等。比特币是用的Pow(工作量证明算法)共识,通过算力计算。PBFT是拜占庭容错算法,若区块链上有3N+1个节点,那么最大的恶意节点数不能超过N个,这里设计到一个经典的算法,拜占庭将军问题,本篇暂不对这个问题进行讲解。作者当初在学习研究时用的是noop算法,是一套“假”的共识算法。其他一些共识算法比如PoS(Proof of Stake,权益证明)、DPoS(Delegate Proof of Stake,委托权益证明)、Ripple(瑞波)等。

Consensus algorithms: PBFT, PoW, Pos, etc.. Bitcoin is a Pow (calendum proof algorithm) consensus, calculated by force of law. PBFT is a Byzantine aptness algorithm, and if there are 3N+1 nodes in the chain of blocks, the maximum number of malicious nodes cannot exceed N. It is designed to be a classic algorithm, General Byzantine’s problem, and the present book is silent on this issue. The author’s study was based on a noop algorithm, a “false” consensus algorithm. Some other consensus algorithms such as PoS (Proof of Starke, certificate of interests), DPoS (Delegate Proof of Starke, commission certificate of interests), Ripple, etc.

(3)区块

当共识节点按照某个共识算法一致通过后,就会在区块链上广播通知所有的节点,广播完成之后就会生成一个新的区块,区块链就是由一个一个的区块链接组成的。

When consensus nodes are unanimously adopted according to a consensus algorithm, all nodes are reported on the block chain, and a new block is created when the broadcast is completed, consisting of a link to one block.

区块链结构示意图

区块的数据结构如上图,包含:前一区块的Hash,当前区块的Hash、时间戳以及交易相关的数据。

The data structure of the blocks, as shown above, includes: Hash of the previous block, Hash of the current block, time stamp and transaction-related data.

当一个区块生成后,就永久保存在区块链中了,所有的节点都权限去访问这个区块的数据,这样就做到公开化,透明化,不会因为恶意操作或者其他因素去篡改数据。达到相互之间信任的目的。

When a block is created, it is permanently stored in the chain of blocks, and all nodes are given access to the data of the block, so that it is open and transparent and does not distort the data because of malicious operations or other factors.

(4)链码(chaincode)

链码又叫智能合约,当我们在区块链上发起交易或者查询交易时,就需要一定的规则进行交易。智能合约一般是由程序员写,写好之后部署到区块链上,相应的交易就可以按照这个智能合约进行。就好比企业之间的合同签订。

The chain code is called smart contracts, and when we start a transaction on a block or search for a transaction, there are rules to deal with. Smart contracts are usually written by programmers and then deployed on a block chain, and the corresponding transaction can be made in accordance with this smart contract.

chaincode可以由go、nodejs等编写。作者当初用的是go,编写好后部署到IBM的fabric系统上。对外提供有query、invoke等接口。

The author used Go, which was prepared for deployment to IBM’s Fabric system. The interfaces are query, invoke, etc.

区块链按照性质可划分为公有链、私有链、联盟链。

Block chains can be divided by nature into public, private and union chains.

(1)公有链

在公有链上,任何个人都可以加入,对数据进行读写和交易,权限的门槛比较低。比较著名公有链应用比如比特币。公有链有数据公开并且透明性、匿名性、访问门槛低等特点。当公有链上的区块达到一定数量时,访问的速度会降低。这也是公有链的弊端。

On the public chain, any individual can join, and the data can be read and written and traded, with lower thresholds of authority. More famous public chain applications, such as Bitcoin, have features such as data openness and transparency, anonymity, and low access thresholds. When the number of blocks on the public chain reaches a certain number, the speed of access decreases. This is also the disadvantage of the public chain.

(2)私有链

与公有链相反,私有链是一种非“公开”的链,一般用于企业内部,需要授权才能加入节点。加入的节点一般有访问数据的权限,而写入权限被严格控制。例如蚂蚁金服,就是比较知名的私有链应用。

Contrary to the public chain, the private chain is a non- “public” chain that is generally used within the enterprise and requires authorization to add nodes. The added nodes usually have access to data, while writing rights are strictly controlled. For example, an ant gold jacket is a more well-known private chain application.

私有链有交易速度快、私密性好、交易成本低、安全性高等特点。弊端是少数节点有权限、数据容易被操控、代码易被修改等。

Private chains have the characteristics of speed, privacy, low transaction costs, and high security. The disadvantages are that a few nodes have access, data are easily manipulated, codes are easily modified, etc.

(3)联盟链

联盟链是由不同的机构或组织共同管理的区块链,只有经过授权后才能加入和退出,每个机构或组织管理一个或几个节点。每个机构或组织有实体机构组织。联盟链适合组织机构间的交易和结算。

The chain of alliances is a block chain that is jointly managed by different institutions or organizations and can only be joined and withdrawn with authorization, with each agency or organization managing one or more nodes.

比较知名的有中国区块链研究联盟(CBRA)和微众银行等。

More prominent are the China Block Chain Research Alliance (CBRA) and Microbanks, among others.

文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明 网址:https://netpsp.com/?id=70137

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
可以去百度分享获取分享代码输入这里。
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
关注我们

若遇到问题,加微信客服---清歌

搜索
排行榜
扫一扫,加我为微信好友加我为微信好友