?中本聪(Satoshi Nakamoto), 2008
♪ Satosh Nakamoto, 2008
?比特币:一种点对点的电子现金系统
♪ Bitcoin: an electronic cash system ♪ strong > point to point
1.两个核心技术:
?以链式区块组织账本数据实现账本数据的不可篡改
? chain block organization of book data to achieve non-manual alteration of book data
?分布式的可信记账机制
♪ Distributed, credible accounting mechanisms
2.共识机制:由谁记账
?目的:
?
? 解决记账权
♪ Resolve the rights to bookkeeping
? 场景:
? scene #xff1a;
? 开放系统,动态增减,海量节点
? Open System xff0c; Dynamic Add xff0c; Big Node
?解决方案
♪ Strong ♪ Solution
? 工作量证明(proof of work):高强度哈希计算 (SHA256)进行算力竞争解决记账权,达成共识。
• Workload certification & #xff08; proof of work & #xff09; & #xff1a; high-strength Hashi calculation (SHA256) for arithmetic competitor rights to account #xff0c; consensus.
3.共识协议模型:
? 节点海量、动态增减
♪ Node size, dynamic increase and decrease
? 存在恶意节点
♪ There's a malignant node
? PBFT算法要求节点集相对稳定,数量有限,不适用
? PBFT algorithm requires relative stability of node set xff0c; limited quantity xff0c; not applicable
? 工作量证明PoW共识
The PoW Consensus ?
? 划定固定时间段(10分钟)
♪ Set fixed time periods ♪ #xff08; 10 minutes ♪ #xff09;
? 相同或相似输入数据(组装的区块)
Same or similar input data xff08; blocks assembled xff09;
? 算力竞争选出获胜节点,其它节点验证结果后不再发送消息
♪ Arithmetic competition selects winning node ♪ #xff0c; other node validates results without sending messages
? 最长链原则,从短期共识扩展到长期共识
♪ Maximum chain principle xff0c; extending from short-term to long-term consensus
?区块链
♪ Strong ♪ block chain
? 基于哈希值进行链接
♪ Links based on Hashi
?特点
♪ Strong ♪ characteristics
? 区块链中数据无法篡改或删除
♪ Data in block chains cannot be tampered with or removed
? 区块链越长可信度越高
♪ The longer the block chain is more credible
1.区块组成
?每个区块包括区块头和交易数据两个部分
? Each block includes two parts: block head and transaction data
? 区块头由当前区块的元数据和前一区块的Hash值构成
♪ Blockhead consists of metadata of the current block and Hash values of the previous block
? Merkle树用于对交易数据列表进行快速寻址
# Merkle tree is used to quickly locate the list of transactional data
2.区块的结构
区块头的结构
3.区块头代码
4.区块标识符:区块头哈希值和区块高度
? 区块主标识符是它的加密哈希值,一个通过SHA256算法对区块头进行二次哈希计算而得到的数字指纹。例如 :000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f是第一个比特币区块的区块哈希值。
* The block master identifier is its encrypted hypnotic value xff0c; a digital fingerprint obtained from a secondary hash calculation of the block head using the SHA256 algorithm. For example: 00000000019d6689c085ae 165831e 934ff763ae46a2a6c172b3f1b60ce26f is the Hashi value of the first bitcoin block.
? 区块哈希值实际上并不包含在区块的数据结构
♪ The Hashi value of blocks does not actually contain the data structure of blocks
? 第二种识别区块的方式是通过该区块在区块链中的位置,即“区块高度(block height)”。例如:高度为0的区块就是创世区块。
The second way of identifying blocks is through the location of the block in the block chain xff0c; i.e., "block height xff08; block height xff09;" e.g. xff1a; a block with a height of 0 is a creation block.
? 和区块哈希值不同的是,区块高度并不是唯一的标识符,因为有可能出现区块链分叉。
♪ Unlike the Hashi value of a block xff0c; the height of a block is not the only identifier xff0c; there is the possibility of a block chain split.
5.Merkle树
? Merkle树是一种哈希二叉树,它是一种用作快速归纳和校验大规模数据完整性的数据结构。这种二叉树包含加密哈希值。
The Merkle tree is a Hasi fork tree & #xff0c; it is a data structure used to quickly summarize and verify the integrity of large-scale data. This fork tree contains encrypted Hashi values.
? 叶节点是数据块的哈希值。
♪ Leaf node is the Hashi value of the data block. ♪
? 非叶节点的哈希值是根据它下面子节点的值哈希计算得到。
The Hashi value for non-leaf nodes is calculated on the basis of the Hashi value for the sub-nodes below it.
? 在比特币网络中,Merkle树被用来归纳一个区块中的所有交易,同时生成整个交易集合的数字指纹,且提供了一种校验区块是否存在某交易的高效途径。
* In the Bitcoin network xff0c; Merkle trees are used to summarize all transactions in a block xff0c; also generate digital fingerprints for the entire pool of transactions xff0c; and provide an efficient way to verify whether a block has a transaction.
? Merkle树中使用两次SHA256算法计算结点的哈希值。
The Merkle tree uses two SHA256 algorithms to calculate the Hashi value of the nodes.
? H~A~ = SHA256(SHA256(交易A)) //两次SHA256是为了提高安全强度
H~A~ & #61; SHA256(SHA256(Text A))/twice SHA256 to increase security intensity
? 当N个数据元素经过加密后插入Merkle树时,你至多计算log2(N)次就能检查出任意某数据元素是否在该树中,这使得该数据结构非常高效。
#xff0c when N data elements are encrypted into the Merkle tree; you can calculate log2(N) at most to see if any data element is in the tree #xff0c; this makes the data structure very efficient.
6.Merkle树的价值:简单支付验证
有了Merkle树,一个节点能够仅下载区块头(80字节/区块),然后通过从一个满节点回溯一条Merkle路径就能认证一笔交易的存在,而不需要存储或者传输区块链中大多数内容。
With Merkle & #xff0c, a node can download only the head of a block & #xff08; 80 bytes / blocks & #xff09; & #xff0c; then authenticate the existence of a transaction & #xff0c by going back from a full node to a Merkle path; and do not need to store or transmit most of the contents of the block chain.
这种不需要维护一条完整区块链的节点,又被称作简单支付验证(SPV)节点,它不需要下载整个区块而通过Merkle路径去验证交易的存在。
This node does not require maintenance of a complete block chain & #xff0c; it is also called simple payment certification & #xff08; SPV) node & #xff0c; it does not need to download the whole block to verify the existence of the transaction through the Merkele path.
7.比特币区块链中的节点
? 全节点 full client:存储着整个区块链,承但对交易请求进行验证和执行,可以通过挖矿争取发布区块,还承担着应别的节点之请向其发送区块和相关交易信息的义务,同时也承担转发交易请求和区块的义务。
? Full node file & #xff1a; stores the entire block chain xff0c; undertakes to verify and execute transaction requests xff0c; can attempt to release blocks xff0c through mining; undertakes to send blocks and related transaction information to other node requests xff0c; also undertakes to forward transaction requests and blocks.
? 矿工节点? ? 非矿工节点
♪ Miner node ♪ non-miner node
? 轻节点 light client :
Light client & #xff1a;
①?简单支付验证(SPV)节点 :只存储区块头,不存储区块块体,仍可以对到来的交易请求进行
1? Simple payment validation xff08; SPV) node & #xff1a; only storage block xff0c; no block block xff0c; still available for incoming transaction requests
验证。
Authentication.
②钱包 :一个连接区块链的应用软件(app),记录与所有者有关的信息:
2 wallets & #xff1a; application to connect a block chain (app) & #xff0c; record owner-related information & #xff1a;
区块链地址、私钥、账户余额、UTXO等,不存储账本。
Block chain addresses, private keys, account balances, UTXO et al. xff0c; accounts are not stored.
8.SPV(钱包)验证过程
? 针对某个支付到自己比特币地址的交易建立布隆过滤器,限制只接收含有目标比特币地址的交易。
#xff0c for a transaction that is paid to its own Bitcoin address; restrictions on receiving only transactions that contain the targeted Bitcoin address.
? 其他全节点探测到某个交易符合SPV节点设置的布隆过滤器条件时,以 Merkleblock消息的形式发送该区块,Merkleblock消息包含区块头和一条连接目标交易与Merkle根的Merkle路径。
# Other full node detects a transaction meeting the Bloom filter conditions set by the SPV node & #xff0c; sends the block & #xff0c in the form of a message Merkleblock; the Merkleblock message contains a block head and a Merkle path linking the target transaction to Merklegen.
? 交易的存在性验证:SPV节点通过该Merkle路径找到跟该交易相关的区
♪ The existence of the transaction ♪ #xff1a; SPV node found the area associated with the transaction through the Merkle path
块,并验证对应区块中是否存在目标交易(Merkle Path Proof)。
Block & #xff0c; and verify the existence of targeted transactions in the corresponding block & #xff08; Merkle Path Proof)
? 交易是否双化验证:SPV节点检查这笔交易所在区块之后的区块个数,区块个数越多说明该区块被全网更多节点共识,一般来说,一笔交易所属区块之后的区块个数达到6个时,说明这笔交易是可信的。
• Whether the transaction doubles & #xff1a; SPV nodes check the number of blocks on the exchange after the block & #xff0c; the number of blocks per block indicates that the block has more node consensus & #xff0c; in general & #xff0c; and when the number of blocks after a transaction reaches
区块头代码
交易的数据结构
挖矿通常指的是通过使用计算硬件(如ASIC矿机、GPU等)来解决数学难题,以验证加密货币网络上的交易并创建新的加密货币的过程。这是区块链技术中的一个关键环节,特别是对于工作量证明(Proof of Work, PoW)的加密货币,如比特币。
Mining usually refers to the process of verifying transactions on an encrypted currency network and creating a new encrypted currency through the use of computing hardware & #xff08; ASIC machines, GPUs, etc. & #xff09; xff0c; this is a key link in block chain technology xff0c; especially for workload certification xff08; Proof of Work, PoW&xff09; encrypted currency xff0c; e.g. Bitcoin.
在挖矿过程中,矿工们竞争解决复杂的算法问题。当一个矿工成功找到一个区块的解决方案时,他们将这个区块添加到区块链上,并因此获得新生成的加密货币作为奖励。这个奖励机制是加密货币发行的一部分,也是维持网络安全和去中心化的一种方式。
In mining, xff0c; miners compete to solve complex algorithmic problems. When a miner succeeds in finding a solution to a block xff0c; they add the block to the block chain xff0c; and, as a result, they get the newly generated encrypted currency as an incentive. This incentive is part of an encrypted currency distribution xff0c; it is also a way to maintain network security and decentralisation.
? 挖矿节点必须有钱包功能
♪ Digging nodes must have wallets
? 有自己的160位密码地址、私钥
♪ It's got its own 160-digit password address, private key
? 打包生成区块时,区块中额外加一个交易coinbase
♪ When packing blocks & #xff0c; an additional transaction in blocks
? 生成一个UTXO,包含当前奖励数量的比特币(现在是6.25)
♪ Generate a UTXOxff0c; includes the current number of bitcoinxff08; now 6.25)
? 这个UTXO的招领地址是自己的地址
♪ This UTXO's offer address is his own
? 如果记账成功,这个coinbase交易就生效,否则不在链上。
♪ If the booking succeeds xff0c; this coinbase transaction takes effect xff0c; otherwise it is not on the chain.
? ? ? ? ? ? ? ? ? ?
然而,挖矿需要大量的电力和计算资源,因此它也是一个能源密集型的过程。在中国,由于对能源消耗和金融稳定的考虑,已经对加密货币挖矿进行了严格的限制。
However, xff0c; mining requires large amounts of electricity and computational resources xff0c; it is therefore also an energy-intensive process. In China xff0c; due to considerations of energy consumption and financial stability xff0c; there are severe restrictions on encrypted currency mining.
算力竞争:
电力消耗:
Electricity consumptionxff1a;
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论