为什么 Git 不被视为“区块链”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46192377/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:07:36  来源:igfitidea点击:

Why is Git not considered a "block chain"?

githashblockchain

提问by Paebbels

Git's internal data structure is a tree of data objects, wherein each objects only points to its predecessor. Each data block is hashed. Modifying (bit error or attack) an intermediate block will be noticed when the saved hash and the actual hash deviate.

Git 的内部数据结构是一棵数据对象树,其中每个对象只指向它的前身。每个数据块都经过哈希处理。当保存的散列和实际散列偏离时,将注意到修改(位错误或攻击)中间块。

How is this concept different from block chain?
Git is not listed as an example of block chains, but at least in summaries, both data structure descriptions look alike: data block, single direction reverse linking, hashes, ...).

这个概念与区块链有何不同?
Git 没有被列为区块链的例子,但至少在总结中,两种数据结构描述看起来很相似:数据块、单向反向链接、散列,......)。

So where is the difference, that Git isn't called a block chain?

那么,Git 不被称为区块链的区别在哪里?

采纳答案by houtanb

gitis not an example of blockchain technology for several reasons (these were the first that came to mind):

git不是区块链技术的例子有几个原因(这些是第一个想到的):

  1. In a blockchain implementation, every block is verified independently multiple times before it is added to the blockchain. This is indeed one of the most important things about blockchain technology and is what ensures its "unhackability." On the other hand, many gitprojects do not require independent verification and, when they do, they only require one person to sign off on a change before it is committed to the repository. Hence, with at most one point of validation that you must trust, gitbreaks one of the core tenets of blockchain technology.

  2. A gitrepository is not necessarily duplicated on many servers. You can work from a gitrepository locally and if your local disk were corrupted, you would lose everything. Blockchain technology implies the reproduction of the ledger across servers.

  3. You can rewrite githistory. A git push <remote> <branch> --forcewhere <branch>is set to a previous state than that at <remote>would rewrite the history. In blockchains, the ledger is an immutable history.

  1. 在区块链实现中,每个区块在添加到区块链之前都会经过多次独立验证。这确实是区块链技术最重要的事情之一,也是确保其“不可破解性”的原因。另一方面,许多git项目不需要独立验证,当他们这样做时,他们只需要一个人在更改提交到存储库之前签字。因此,最多只有一个您必须信任的验证点,就git打破了区块链技术的核心原则之一。

  2. 一个git仓库不一定复制在许多服务器上。您可以从git本地存储库工作,如果您的本地磁盘损坏,您将丢失所有内容。区块链技术意味着跨服务器复制分类帐。

  3. 你可以改写git历史。将git push <remote> <branch> --forcewhere<branch>设置为比 at 之前的状态<remote>会重写历史记录。在区块链中,账本是不可改变的历史。

回答by poke

The reason why Git and blockchains appear similar is because they are both using merkle treesas their underlying data structure. A merkle tree is a tree where each node is labeled with the cryptographic hash value of their contents, which includes the labels of its children.

Git 和区块链之所以看起来相似,是因为它们都使用默克尔树作为其底层数据结构。默克尔树是一种树,其中每个节点都标有其内容的加密哈希值,其中包括其子节点的标签。

Git's directed acyclic graph is exactly that, a merkle tree where each node (tag, commit, tree, or blob object) is labeled with the hash of its content and the label of its “child”. Note that for commits, the “child” term conflicts a bit with Git's understanding of parents: Parent commits arethe children of commits, you just need to look at the graph as a tree that keeps growing by re-rooting it.

Git 的有向无环图正是这样,一棵默克尔树,其中每个节点(标签、提交、树或 blob 对象)都用其内容的哈希值及其“子节点”的标签进行标记。请注意,对于提交,“子”一词与 Git 对父项的理解有些冲突:父项提交提交的子项,您只需要将图视为一棵树,并通过重新植根来不断增长。

Blockchains are very similar to this, since they also keep growing that way, and they are also using its merkle tree property to ensure data integrity. But usually, blockchains are understood as way more than just merkle trees which is where they are separating from the “stupid content tracker” Git. For example, blockchains usually also means having a highly decentralized system on a block level (not all blocks need to be in the same place).

区块链与此非常相似,因为它们也在以这种方式不断增长,并且它们还使用其默克尔树属性来确保数据完整性。但通常,区块链被理解为不仅仅是 Merkle 树,这是它们与“愚蠢的内容跟踪器”Git分离的地方。例如,区块链通常还意味着在区块级别拥有一个高度分散的系统(并非所有区块都需要在同一个地方)。

Understanding blockchains is kind of difficult (personally, I'm still far away from understanding everything about it), but I consider understanding Git internals as a good way to understand merkle trees which definitely helps understanding a fundamental part about blockchains.

理解区块链有点困难(就我个人而言,我离理解它的一切还很远),但我认为理解 Git 内部是理解默克尔树的好方法,这绝对有助于理解区块链的基本部分。

回答by Brian Sullivan

Cyber Currencies like Bitcoin, use a distributed consensuses cryptographic chain of blocks (merkle tree). Common usage has shortened this to 'blockchain'

像比特币这样的网络货币使用分布式共识加密区块链(默克尔树)。常见用法已将其缩短为“区块链”

While git uses a chain of blocks (merkle tree), it lacks the distributed consensuses cryptographic components that common usage of the term 'BlockChain' imply.

虽然 git 使用区块链(默克尔树),但它缺乏“区块链”一词的常见用法所暗示的分布式共识加密组件。

回答by Daniel Vartanov

Blockchainis notjust any chain of any blocks.

Blockchain不是随便一个块的任何链。

Blockchainis when there is a way of determining the main chain when two or more are diverted, and when no central authority is needed for that determination.

Blockchain是当两个或更多被转移有一种确定主链的方法,并且当该确定不需要中央权威时。

回答by Miguel Mota

Unlike cryptocurrency blockchains; git doesn't have a p2p trustless consensus mechanism.

加密货币区块链不同;git 没有 p2p 无信任共识机制。

回答by asing177

The Goals are different for blockchain and git although both use merkle trees as data structure.

尽管区块链和 git 都使用默克尔树作为数据结构,但目标是不同的。

A blockchainis typically managed by a peer-to-peer network adhering to a protocol for inter-node communication and validating new blocks. Once recorded, the data in any given block cannot be altered retroactively without alteration of all subsequent blocks, which requires consensus of the network majority.

Ablockchain通常由点对点网络管理,该网络遵守用于节点间通信和验证新块的协议。一旦记录,任何给定块中的数据都不能在不更改所有后续块的情况下进行追溯更改,这需要网络多数人的共识。

As According to Bitcoin whitepaper :

根据比特币白皮书:

A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. Digital signatures provide part of the solution, but the main benefits are lost if a trusted third party is still required to prevent double-spending. We propose a solution to the double-spending problem using a peer-to-peer network. The network timestamps transactions by hashing them into an ongoing chain of hash-based proof-of-work, forming a record that cannot be changed without redoing the proof-of-work. The longest chain not only serves as proof of the sequence of events witnessed, but proof that it came from the largest pool of CPU power. As long as a majority of CPU power is controlled by nodes that are not cooperating to attack the network, they'll generate the longest chain and outpace attackers. The network itself requires minimal structure. Messages are broadcast on a best effort basis, and nodes can leave and rejoin the network at will, accepting the longest proof-of-work chain as proof of what happened while they were gone

纯粹的点对点版本的电子现金将允许在线支付直接从一方发送到另一方,而无需通过金融机构。数字签名提供了部分解决方案,但如果仍然需要受信任的第三方来防止双重花费,那么主要的好处就会丧失。我们提出了一种使用点对点网络的双花问题的解决方案。网络通过将交易散列到一个持续的基于散列的工作量证明链中来对交易进行时间戳记,形成一个记录,如果不重新进行工作量证明就无法更改。最长的链不仅可以证明所见证的事件序列,还可以证明它来自最大的 CPU 资源池。只要大部分 CPU 功率由不合作攻击网络的节点控制,它们就会 将生成最长的链并超越攻击者。网络本身需要最少的结构。消息在尽最大努力的基础上广播,节点可以随意离开和重新加入网络,接受最长的工作量证明链作为他们离开时发生的事情的证明

While Gitis a distributed version-control system for tracking changes in source code during software development.It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows.

WhileGit是一个分布式版本控制系统,用于在软件开发过程中跟踪源代码的更改。它旨在协调程序员之间的工作,但它可用于跟踪任何一组文件中的更改。其目标包括速度、数据完整性以及对分布式非线性工作流的支持。

As according to Linus Torvalds:

正如 Linus Torvalds 所说:

In many ways you can just see git as a filesystem – it's content-addressable, and it has a notion of versioning, but I really designed it coming at the problem from the viewpoint of a filesystem person (hey, kernels is what I do), and I actually have absolutely zero interest in creating a traditional SCM system.

在许多方面,您可以将 git 视为一个文件系统——它是内容可寻址的,并且具有版本控制的概念,但我确实是从文件系统人员的角度设计它来解决问题的(嘿,内核就是我所做的) ,而且我实际上对创建传统的 SCM 系统完全没有兴趣。

回答by Gopinath

Block chain is Distributed ledger

区块链是分布式账本

  • Block chain allows autonomous clients to perform transactions.

  • Block chain provides a fool-proof method of validating any transaction between any pair of peers.

  • Block chain does not allow the participating member to have its own version of truth.

  • Truth is immutable (unchangeable) and can be validated independently by every participating member in the block chain system.

  • 区块链允许自治客户端执行交易。

  • 区块链提供了一种万无一失的方法来验证任何对等点之间的任何交易。

  • 区块链不允许参与成员拥有自己的真实版本。

  • 真理是不可变的(不可改变的),并且可以被区块链系统中的每个参与成员独立验证。



Git is Centralized data repository

Git 是集中式数据存储库

  • Git allows contributions to central repository from autonomous clients.

  • Git provides freedom to each client to maintain its own version of truth.

  • Git does not provide any trust model for transactions between clients.

  • Git does not provide a method to verify or validate any transaction.

  • Git does not provide a means for one client to validate the authenticity of transaction performed by another client.

  • Git allows the server in the GIT system to maintain a history of changes to truth. Changes to truth can be rolled back, but never be validated and the client that changed the truth can never be challenged.

  • Git 允许自治客户端对中央存储库的贡献。

  • Git 为每个客户提供了维护自己真实版本的自由。

  • Git 不为客户端之间的事务提供任何信任模型。

  • Git 不提供验证或验证任何事务的方法。

  • Git 没有为一个客户端提供一种方法来验证另一个客户端执行的交易的真实性。

  • Git 允许 GIT 系统中的服务器维护真实的更改历史记录。对真相的更改可以回滚,但永远不会被验证,更改真相的客户端永远不会受到挑战。

Therefore, it can be proved that Git is not an example of 'block chain'.

因此,可以证明 Git 不是“区块链”的一个例子。



More information on block chain:

更多关于区块链的信息:

https://www.ibm.com/uk-en/blockchain/what-is-blockchain

https://www.ibm.com/uk-en/blockchain/what-is-blockchain

https://www.hyperledger.org/wp-content/uploads/2018/08/HL_Whitepaper_IntroductiontoHyperledger.pdf

https://www.hyperledger.org/wp-content/uploads/2018/08/HL_Whitepaper_IntroductiontoHyperledger.pdf

https://www.oracle.com/uk/blockchain

https://www.oracle.com/uk/blockchain

回答by Alex F

As poke said:

正如poke 所说

Git and Blockchains appear similar because they are both using Merkle Treesto store ordered timestamped transactions.A merkle tree is a tree data structure where each node is labeled with the cryptographic hash value of their contents, which includes the labels of its children.

Git 和区块链看起来很相似,因为它们都使用Merkle 树来存储带时间戳的有序交易。Merkle 树是一种树数据结构,其中每个节点都标有其内容的加密哈希值,其中包括其子节点的标签。

The first difference is the Hash function: Blockchain has a very expensive hash function so that each block has to be mined, wheras a Git "block" can be created with a simple commit message.

第一个区别是散列函数:区块链具有非常昂贵的散列函数,因此每个块都必须被挖掘,而 Git“块”可以通过简单的提交消息创建。

The purpose of Bitcoin is to add trust to the order of transactions.The focus is on the longest chain, since that is most expensive to compute and thus most likely to be the truth.

比特币的目的是增加对交易顺序的信任。重点是最长的链,因为它的计算成本最高,因此最有可能是事实。

Bitcoin accomplishes this by requiring that the hash meets certain parameters (begins with a specific number of 0s), by incrementing a value ("nonce") in the message until a satisfactory hash is found. This takes effort to find, but only 1 calculation to verify for a nonce; and if multiple nonces produce a satisfactory hash, then one will be lower and taken as the truth. Other authentication schemes make the hash trustworthy by centralizing the issuing of the hash to an authority, perhaps voted by network agreement, or some other method.

比特币通过要求散列满足某些参数(以特定数量的 0 开始)来实现这一点,通过增加消息中的值(“nonce”)直到找到令人满意的散列。这需要努力寻找,但只需 1 次计算即可验证随机数;如果多个 nonce 产生令人满意的散列,那么一个会更低并被视为真相。其他身份验证方案通过将散列的发布集中到权威机构(可能通过网络协议或其他方法进行投票)来使散列值得信赖。

Blockchain data is limited to transactions, which must must conform to validation. Transaction must be valid to be included in the next block. A Bitcoin transaction corresponds to something important in the real world that justifies using an expensive block to record this transfer, like exchange of money value.We don't actually care about the final ledger, it's a metaphor for something in the real world.

区块链数据仅限于交易,交易必须符合验证。交易必须有效才能包含在下一个区块中。比特币交易对应于现实世界中的重要事物,可以证明使用昂贵的区块来记录这种转移是合理的,例如货币价值的交换。我们实际上并不关心最终分类帐,它是对现实世界中某些事物的隐喻。

By contrast, Git blocks are arbitrary, as a commit can contain any amount of data. The value lies in the changes of data being organized into the git tree because we care about the final product, it's validated by the existence of the git repository.

相比之下,Git 块是任意的,因为提交可以包含任意数量的数据。价值在于将数据的更改组织到 git 树中,因为我们关心最终产品,它通过 git 存储库的存在来验证。

The purpose of Git is to allow cheap "ledgers" to track multiple product alternatives.The "ledger" in Git is what we care about, it's our final product; the transactions data just record how the product was built. We want to make it very cheap to make multiple versions of final products, just enough overhead to require the creator to record how they built this product. No explicit validation is done on the data, you maintain the end-product if it looks good, and that existence makes it useful to have the chain of this product's creation. If the end-product is bad or the order of commits is invalid, this "ledger" gets deleted during garbage collection.

Git 的目的是允许廉价的“分类帐”跟踪多种产品替代品。Git 中的“账本”是我们关心的,它是我们的最终产品;交易数据只记录产品是如何构建的。我们希望制作最终产品的多个版本非常便宜,只需足够的开销来要求创建者记录他们如何构建这个产品。没有对数据进行明确的验证,如果最终产品看起来不错,您就可以维护它,并且这种存在使得拥有该产品的创建链很有用。如果最终产品不好或提交顺序无效,则此“分类帐”会在垃圾收集期间被删除。

The second difference is that Blockchain transactions must come from a prior valid source.In Git, we don't care what data you use to extend the tree. In Blockchain, the transactions must come from a prior valid source. In that sense, Git tracks the extension of our environment, whereas Blockchain tracks the exchange of value within a closed environment.

第二个区别是区块链交易必须来自先前的有效来源。在 Git 中,我们不关心您使用什么数据来扩展树。在区块链中,交易必须来自先前的有效来源。从这个意义上说,Git 跟踪我们环境的扩展,而区块链跟踪封闭环境中的价值交换。