比特币(BSV)知识库:数据库-区块链(Block chain)

BSV知识库 专栏收录该内容
83 篇文章 2 订阅

区块链

比特币区块链是比特币网络上参与挖矿过程的节点所构建的交易数据库。区块链包含了由网络中的节点进行验证和处理的交易。通过区块链,任何人都可以计算并建立起账本中所有已确认交易的记录,直到有新的区块被挖出。

每个区块都包含了对它前一个区块的引用。这就形成了一条从创世区块到最新区块的链状结构。区块被构造出来一段时间之后,想要修改区块上的内容需要付出巨大的计算量,所以修改区块内容在计算层面上是不现实的。

在由工作量证明产生的最长链之上,节点会选择一个他们认为的最新有效区块,通过在该区块的基础上构造新区块来延长整个区块链。节点可通过拒绝在某个区块之上进行挖矿来表示自己的质疑。若某一区块没有成为工作量证明意义下的最长链的一部分,则被称为孤块

对于区块链上的任一区块来说,只有一条路径可以回到创世区块。然而,以创世区块为起点,区块链是可以产生分叉的。当两个有效区块的构造时间仅仅相隔几秒时,时不时地就会产生分叉,这就引发了所谓的孤块竞赛。当这种情况发生时,每个节点都试图在它们最先收到的区块上构建新区块。这会对节点产生强烈的激励,让节点形成近完全图的结构,这样的结构可以缩短区块广播的时间。当一个新区块被挖出时,它所在的链有更大的机会成为最长链,从而孤立它的竞争对手。

当节点在网络规则方面存在不同意见时,分叉也可能发生。由于节点管理者之间的意见分歧,比特币发生了两次著名的分叉。第一次分叉发生在2017年,在比特币核心(Bitcoin Core)节点选择将“隔离见证”技术纳入BTC网络规则后,比特币产生了一条名为BCH的分叉。第二次分叉发生在2018年11月,原因则是BitcoinABC节点选择实施与原始协议不一致的新操作码和共识规则。

较短链(非最长链)或无效链上的区块是没有用的,在构造这些区块的过程中所付出的工作量都将被废弃。如果一个节点在构造新区块的过程中,检测到了一条更长的链,那么在较短链上的未完成区块中的所有有效交易都将被重新添加到交易序列池中,等待被打包成新的区块。较短链上的挖矿奖励不会出现在最长链上,这些奖励实际上是会消失的,这就是为什么对于coinbase交易来说,要存在一个网络强制的长达100个区块的成熟时间。也就是说,在coinbase交易产生的100个区块之后,这笔coinbase交易所产生的奖励才可以被花费。

因为协议规定一个区块只能引用一个前序区块,所以两条分叉链是不可能合并的。

新的区块通过比特币网络协议广播至网络上所有的节点。


Block chain

The Bitcoin block chain is the transaction database that is built by nodes participating in the mining process on the Bitcoin network. The block chain contains transactions validated and processed by nodes on the network. Using the block chain anyone can calculate and build a record of all of the confirmed transactions that have taken place on the ledger up until the most recent block was found.

Every block contains a reference to the block it builds upon. This has the effect of creating a chain of blocks from the genesis block to the current block. Blocks become computationally impractical to modify once they have been built upon for a period of time due to the amount of work that would need to be regenerated.

Nodes extend the blockchain by building on what they consider to be the most recent valid block, in the longest chain of proof of work. Nodes can dispute blocks by choosing not to build upon them. Any block that does not become part of the longest chain of work is referred to as an Orphan Block.

For any block on the chain, there is only one path back to the genesis block. Coming from the genesis block, however, there can be divergence in the chain. Forks are created from time to time when two valid blocks are created just a few seconds apart, sparking what's known as an orphan race. When this occurs, each node will attempt to build a new block upon whichever of the competing blocks they received first. This has the effect of creating a very strong incentive for nodes to form a Nearly Complete Graph as a means to minimize the propagation time of blocks. When a new block is found, the block it was built upon has a much greater chance of becoming part of the longest chain and orphaning its competitor.

Forks can also occur when nodes disagree on network rules. Two notable forks have occurred on Bitcoin as a result of disagreements between node operators. The first occurred in 2017 when Bitcoin was forked onto the BCH network after Bitcoin Core nodes elected to adopt Segregated Witness into the BTC network rules and again in November 2018 when BitcoinABC nodes elected to implement new opcodes and consensus rules that were unaligned with the original protocol.

Blocks in shorter or invalid chains cannot be used for anything and any proof of work that went into their creation is discarded. If a node detects the creation of a longer chain than the one it is working on, all valid transactions of the block template inside the shorter chain, are re-added to the pool of queued transactions to be included in a new block. The reward for the blocks on the shorter chain will not be present in the longest chain, so they will be practically lost, which is why a network-enforced 100-block maturation time for spending coinbase transactions exists.

Because the protocol specifies that a block must only reference one previous block, it is impossible for two forked chains to merge.

Blocks are broadcast to all nodes on the network using the Bitcoin Network protocol.

声明:

比特币(BSV)知识库项目由比特币协会(Bitcoin Association)发起并支持,更多信息请参见知识库官网:https://wiki.bitcoinsv.io/


  • 对比特币区块链开发感兴趣的朋友可以通过CSDN站内私信联系我们,申请加入BSV开发者交流群。
  • 同时,您也可以扫描下方二维码,关注比特币协会官方微信公众号——BA资讯,了解更多区块链领域的实时资讯。

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值