什么是以太坊节点和分片?

在本指南中,您将了解什么是以太坊节点和分片。如果您想了解更多信息,请查看我们的区块链价格。

如果你去年以加密的形式活跃过,那么你就会知道有一个问题困扰着比特币和以太坊:可扩展性。

比特币通过激活Segwit和硬分配到比特币现金来解决这个问题。然而,以太坊正试图以不同的方式解决这个问题。他们希望激活的众多协议中的一个,当它们进入下一阶段的增长时,就是“分片”。在我们理解这意味着什么之前,我们需要彻底了解网络和节点。

什么是以太坊节点和分片?

  • 培养成为区块链开发者
  • 什么是以太坊节点和分片?
  • 为什么我们需要电信网络?
  • 什么是点对点网络?
  • 为什么人们使用点对点网络?
  • 在加密货币中使用网络和节点。
  • 什么是Light Client?
  • 什么是完整节点?
  • 以太坊面临的可扩展性问题是什么?
  • 什么是分片?
  • 在区块链的背景下进行分片
  • 那么跨分片通信是如何发生的呢?
  • 什么是以太坊节点和分片:结论
  • 培养成为区块链开发者

培养成为区块链开发者立即开始免费试用什么是以太坊节点和分片?

什么是节点,网络和参数?

让我们通过简单的日常活动来理解这个概念的含义。

(在我们开始之前,请相信3dBuzz的精彩解释。)

想一个盒子:

什么是以太坊节点和分片?

此框接受输入,对它们执行某种操作,然后给出输出。这个盒子是一个“节点”。请记住,节点并不完全是“盒子”,我们在这里只使用一个假设的情况。

网络是这些节点的集合,它们彼此相互链接。

参数是节点绑定的规则。

从本质上讲,这就是节点和网络。现在让我们看看通过节点和网络解释的一些简单的日常活动。

让我们看看简单的碎纸机是如何工作的。

什么是以太坊节点和分片?

那么,这里发生了什么?

你正在使用三个节点:纸张碎纸机和……井……“切碎的东西”。这三个节点构成了“粉碎网络”。让我们有更多的乐趣。到目前为止,我们假设节点只接受一个输入。如果他们采取更多的措施怎么办?

我们以烤面包机为例。烤面包机有两个输入:

  • 电力
  • 面包

所以这就是它的样子:

什么是以太坊节点和分片?

记住一件事,即使其中一个输入丢失,烤面包机也无法工作。

现在,是时候把它提升到另一个档次。

让我们想一个使用参数的复杂网络。想想你的电视机。您的电视机已连接到您的服务提供商。假设你拥有一个PS4,并且因为你很难做出决定,你也拥有一个Xbox。

所以,如果我们要绘制整个“电视网络”,这就是它的样子:

什么是以太坊节点和分片?

呃,我们这里有问题。

您只能通过电视访问其中一个节点。你现在不能真正看到权力的游戏和玩神秘海域,你呢?那么,您如何确保您的电视一次只能访问一个节点?这是您引入参数的地方。这些参数使您的节点与众不同。假设您想在电视中添加一个名为“Channel Switcher”的参数。这就是频道切换器的工作方式:

  • 如果您按“0”,它将显示正常的电视即服务提供商。
  • 如果按“1”,则可以访问PS4。
  • 如果按“2”,则可以访问Xbox。

只需添加这些参数,您就可以创建节点,即电视唯一。那么,让我们探讨一下我们可以为电视提供哪些其他参数以使其更加独特:

  • 尺寸:说,我们的电视是一个55英寸的屏幕。
  • 颜色:我们的电视是银灰色的。
  • 品牌:我们有索尼电视。
  • 类型:我们有等离子屏幕。

好的,所以现在由于我们的参数,我们有一个更加明确的电视。现在我们知道我们有一个55英寸,银灰色,等离子屏索尼电视。

因此,从我们迄今为止学到的所有内容中,让我们尝试定义节点,网络和参数的含义。

  • 节点:接收输入并对其执行功能并输出输出的各个组件。
  • 网络:彼此互连的节点集合。
  • 参数:定义节点并使其更加唯一的规则

电信环境中的节点和网络

我们的整个电信系统在网络和节点的基础上工作。您的互联网,电话,短信,每一个工作都是因为精心布局的网络和节点。那么,您如何定义电信网络?根据不列颠百科全书,

“电信网络是链路和交易所的电子系统,以及控制其运营的控制,允许多个用户之间的数据传输和交易所。”

为什么我们需要电信网络?

虽然可以在个人之间进行一对一的连接,但这将是非常昂贵和麻烦的。此外,这将是一个非常无效的过程,因为大多数通信线路将处于闲置状态,未充分利用。

为了提高这一过程的效率,我们使用了电信网络。那么,在这种情况下,节点的定义是什么?

在此上下文中,节点是重新分发点或通信端点。

那么,让我们看一个如何工作的例子。考虑一个简单的GSM网络。假设,Alice想要向Bob发送短信,整个系统将如何运作? (Shoutout到Roviell YouTube频道进行解释)。

  • 步骤1:Alice写入消息并按发送。消息转到基站又称BST。 BST将您连接到网络。周围有大量的BST。把它们想象成餐馆里的服务员。你只需举手(发送短信)就可以得到他们的注意力。
  • 步骤2:基站控制器(即BSC)确保BST全部有序并且一切都处于工作状态。使用我们的餐厅类比,BSC是“maîtred'hôtel”或服务员,确保每个餐桌都由服务员照看。 (还记得来自地狱厨房的Jean Phillippe吗?是的,那家伙。)
  • 步骤3:从BSC,消息现在进入移动交易所中心又称MSC。它确保数据从站无缝移动到网络,反之亦然。在我们的餐厅类比中,MSC是主厨,他们接受订单并将其转发给厨师,并在送出餐具之前对餐具进行最后润色。
  • 步骤4:现在消息被发送到短消息服务中心,即SMSC。这些都是类比的厨师。在此处,将保存邮件,直到他们获得有关收件人的更多信息。 SMSC从归属位置寄存器(HLR)和访问者位置寄存器(VLR)等来源获得帮助,这两个数据库包含有关网络的所有信息。它们基本上有助于跟踪发件人和收件人以查看是否可以发送邮件。他们检查收件人的电话是否已关闭,或者是否超出了覆盖范围等。如果由于某种原因无法发送邮件,则它将被存储在SMSC中最多6小时才会被删除。
  • 步骤5:现在,如果SMS很好,SMSC将消息传递给接收者的MSC。
  • 步骤6:SMS进入BSC。
  • 步骤7:BSC将消息转发给BST。
  • 步骤8:BST最后将消息发送给接收者。

因此,这是整个SMS系统如何工作的概述。 BSC,BST,MSC,SMSC,HLR和VLR都是GSM网络中的节点。这就是整个事情的样子:

什么是以太坊节点和分片?

什么是点对点网络?

正常的网络结构是“客户端 – 服务器”结构。

这是如何运作的?

什么是以太坊节点和分片?

有一个中央服务器。每个想要与服务器连接的人都可以发送查询以获取所需信息。这几乎就是互联网的运作方式。当您想要谷歌某事时,您向Google服务器发送一个查询,该服务返回所需的结果。所以,这是一个客户端 – 服务器系统。现在,这个模型有什么问题?

由于一切都依赖于服务器,因此服务器始终能够正常运行以使系统正常工作至关重要。这是一个瓶颈。现在假设,无论出于何种原因主服务器停止工作,网络中的每个人都将受到影响。此外,还存在安全问题。由于网络是中心化的,因此服务器本身处理有关客户端的大量敏感信息。这意味着任何人都可以破解服务器并获取这些信息。此外,还有审查问题。如果服务器决定某个特定项目(电影,歌曲,书籍等)不合适并决定不在其网络中传播该怎么办?

因此,为了解决所有这些问题,出现了一种不同类型的网络架构。它是一个网络,它在参与者之间划分整个工作负载,这些参与者都是同等特权的,称为“同伴”。不再有一个中央服务器,现在有几个分布式和去中心化对等体。这是一个点对点网络。

什么是以太坊节点和分片?

图片礼貌:InfoZones

为什么人们使用点对点网络?

对等网络的主要用途之一是文件共享,也称为torrenting。如果要使用客户端 – 服务器模型进行下载,那么它通常非常慢并且完全取决于服务器的运行状况。另外,就像我们说的那样,它很容易受到审查。

但是,在对等系统中,没有中央权限,因此即使网络中的一个对等体退出竞争,您仍然可以从中下载更多对等体。此外,它不受中央系统的理想标准的约束,因此不容易受到审查。

如果我们要比较两者:

什么是以太坊节点和分片?

图片提供:Quora

随着我们进入下一部分,对等系统的去中心化性变得至关重要。有多重要?那么,将这种点对点网络与支付系统相结合的简单(至少在纸面上)的想法通过产生加密货币彻底改变了金融业。

在加密货币中使用网络和节点。

我们来看看以太坊的网络结构。

以太坊被构造为对等网络,使得参与者(也称为对等体,即节点)不被赋予任何额外的特权。我们的想法是建立一个平等主义的网络。节点没有任何特殊权限,但是它们的功能和参与程度可能不同。没有中心化服务器/实体,也没有任何层次结构。它是一种扁平拓扑。

所有去中心化的加密的结构都是因为一个简单的原因,才能坚持他们的理念。我们的想法是建立一个货币体系,每个人都被视为平等,没有管理机构,可以根据一时兴起决定货币的价值。比特币和以太坊都是如此。

现在,如果没有中央系统,系统中的每个人怎么会知道某个交易发生了?网络遵循八卦协议。想想八卦是如何传播的。假设Alice向Bob发送了3个ETH。离她最近的节点会知道这个,然后他们会告诉最接近他们的节点,然后他们会告诉他们的邻居,这将继续蔓延,直到每个人都知道。节点基本上是你的爱管闲事,烦人的亲戚。

那么,以太坊的上下文中的节点是什么?节点只是参与以太坊网络的计算机。这种参与可以有三种方式

  • 通过保留区块链的浅拷贝,即轻客户端
  • 通过保留区块链的完整副本,即完整节点
  • 通过验证交易即挖矿

什么是Light Client?

正如我们之前提到的,对等系统的想法是在称为“对等体”的节点之间分配网络责任。没有优先考虑其中任何一个。但是,那些想要参与网络却没有系统资源来下载和维护系统中完整区块链的人呢?他们可以选择成为“轻客户”。通过成为Light Client,他们可以获得关于以太坊某些状态的高安全性保证,以及验证交易执行的能力。

什么是完整节点?

连接到以太坊网络的任何计算机都完全执行以太坊的所有共识规则,称为完整节点。完整节点下载用户桌面上的整个区块链。完整节点构成了以太坊系统的主干,使整个网络保持诚实。完整节点强制执行的一些共识规则是:

  • 确保为每个开采的区块(5 ETH)发出正确的区块奖励
  • 交易具有正确的签名
  • 事务和块具有正确的数据格式
  • 任何一个街区都没有双重支出

完整节点基本上验证节点和事务,并将信息中继到其他节点(使用八卦协议)。

矿工与节点

为了简单起见,所有矿工都是完整的节点,但并非所有的完整节点都是矿工。矿工需要运行完整节点才能访问区块链。任何运行完整节点的人都不需要挖矿块。

以太坊面临的可扩展性问题是什么?

在以太坊网络中如何达成共识?网络中的每个节点都进行每次计算,当它们达成共识时,交易被认为是好的。现在,这可能已经正常运作,但是,以太坊已经变得非常受欢迎,并且交易数量一直在稳步增长。看看这个由Etherscan绘制的K线走势图:

什么是以太坊节点和分片?

图片提供:Etherscan

现在,尽管这是一件好事,但网络在达成共识之前必须经历的计算次数因此呈指数级增长。与此同时,还出现了另一个问题。由于某些公司重量级人物的支持以及其ICO的普及,以太坊已被广泛采用。结果,以太坊网络上的节点数量呈指数增长。实际上,它是具有最多节点的加密货币,因此是最去中心化的。

事实上,截至2017年5月,与比特币的7000个相比,以太坊拥有25,000个节点这超过3次。事实上,从4月到5月的节点数量增加了81%……这几乎是两倍

什么是以太坊节点和分片?

图片提供:Trust Nodes。

现在,您可能认为在网络中拥有更多节点将有助于加快交易时间。好吧……再想一想。

共识以线性方式发生。意思是,假设有3个节点A,B和C.

为了达成共识,首先A将进行计算和验证,然后B将执行相同的操作然后C.

但是,如果系统中有一个名为“D”的新节点,那么会向共识系统添加一个节点,这将增加整个时间段。随着以太坊变得越来越流行,交易时间变得越来越慢。

事实上,在速度测试中,有人看到,与PayPal的193和Visa的1667相比,以太坊每秒管理的交易次数仅为20次

现在记住一件事,以太坊并不认为自己只是单纯的货币,他们的最终愿景就是像新的互联网一样。他们希望人们能够在Facebook和Youtube的规模上创建DApp,以便在他们的区块链上运行。为了实现这样的事情,他们需要对可扩展性问题做些什么。

为了解决这个问题,提出了三项提案:

  • 增加块大小
  • 让用户使用不同的alt硬币
  • 拆分

增加块大小

因此,一种解决方案是增加块大小。虽然这肯定会通过增加进入一个块的事务数来提高性能,但是有几个问题可能会因此而发生:

  • 首先,这仍然无法解决节点以较慢的速度达成共识的问题。实际上,随着每个块的事务数量的增加,每个节点的计算和验证数量也将增加。
  • 为了适应越来越多的事务,需要定期增加块大小。这将使系统更加中心化,因为普通计算机和用户将无法下载和保存这种庞大的区块链。这违背了区块链的平等主义精神。
  • 最后,块大小的增加只会通过硬分叉发生,这可能会分裂社区。上一次在以太坊发生重大难民事件时,整个社区都出现了分歧,并且出现了两种不同的货币。人们并不真的希望这种情况再次发生。

让用户使用不同的山寨币。

另一个建议是运行并行区块链而不是一个主区块链。基本上,不是在一个主区块链上运行50个DApp,而是拥有2个区块链,每个区块链运行25个DApps。该提案存在两个问题:

  • 拆分链的哈希值是不明智的。毕竟,链的哈希值决定了外部黑客的安全性和系统的快速性。
  • 恶意矿工在较小的连锁店中获得51%的多数票将更容易。

拆分

最后,分片被确定为以太坊的方式。在我们深入研究分片之前,让我们简单地理解它的含义。假设有三个节点A,B和C并且它们必须验证数据T.而不是A,B和C单独验证整个数据T,数据将被分成3个分片:T1,T2和T3。之后,A,B和C将并排验证一个碎片。正如您所看到的,您节省的时间是指数级的。

无论如何,让我们深入了解

什么是分片?

分片是从数据库系统中获取的术语。让我们看一下分片对数据库的意义。假设您的网站有一个庞大的庞大数据库。拥有庞大的数据库不仅会使数据搜索速度变慢,而且还会妨碍您的可扩展性。那么,在这种情况下你做了什么?

如果对数据执行水平分区并将其转换为较小的表并将其存储在不同的数据库服务器上,该怎么办?

什么是以太坊节点和分片?

图片提供:Dzone

像这样?

现在,您可能会问,为什么是水平分区而不是垂直分区?这是因为表的设计方式:

什么是以太坊节点和分片 -

你看?它是相同的表/数据库,但数据较少。这些较小的数据库称为较大数据库的分片。每个分片应该与相同的表结构相同。

在区块链的背景下进行分片

现在,正如我们所看到的,以太坊共识的问题是所有节点都需要对每个事务进行所有计算和验证。这使整个过程非常缓慢和麻烦。那么,分片如何帮助这个呢?

考虑以太坊区块链的状态,我们称之为“全球状态”,每个人都可以看到。让我们考虑这个全球状态的Merkle Root。 (对于Merkle树和根看了我们关于HASHING的文章)。这个状态根将被分解为分片根,并且每个共享根将具有它们自己的状态。这些状态将以Merkle树的形式表示。

什么是以太坊节点和分片?

这是一个看似非常简单的结构。

现在,让我们进入内部机制。

那么在激活分片后会发生什么呢?

  • 州被分成碎片
  • 每个唯一帐户都在一个分片中
  • 帐户只能与同一分片中的其他帐户进行交易

在Devcon,Vitalik Buterin解释了这样的碎片:

想象一下,以太坊已被分裂成数千个岛屿。每个岛屿都可以做自己的事情。每个岛屿都有自己独特的特征,每个岛屿上的人,即帐户,都可以相互作用,他们可以自由地沉迷于其所有的功能。如果他们想与其他岛屿联系,他们将不得不使用某种协议。

所以,问题是,这将如何改变区块链?

比特币或以太坊(预分片)中的正常块是什么样的?

什么是以太坊节点和分片?

因此,有一个块头和包含块中所有事务的主体。所有事务的Merkle根将在块头中。

现在,想一想。比特币真的需要块吗?它真的需要区块链吗? Satoshi可以通过在较新的交易中包含先前交易的哈希来简单地建立一系列交易,从而形成“交易链”。

他们在块中安排这些事务的原因是创建一个级别的交互并使整个过程更具可伸缩性。以太坊建议的是,他们将此变为两个层次的互动。

第一级

第一级是交易组。每个分片都有自己的事务组。

什么是以太坊节点和分片?

图片提供:Hackernoon

事务组分为事务组头和事务组体。

交易组标题

标题分为不同的左右部分。

左派:

  • Shard ID:事务组所属的分片的ID。
  • 预状态根:这是应用事务之前的分片43的根状态。
  • 发布状态根:应用事务后,这是分片43的根状态。
  • 收据根:应用了分片43中所有事务之后的收据根。

正确的部分:

正确的部分充满了随机验证器,需要验证分片本身的事务。它们都是随机选择的。

交易集团正文

它具有分片本身中的所有事务ID。

第一级的属性

  • 每个事务都指定它所属的分片的ID。
  • 属于特定分片的事务表明它发生在两个特定分片原生的帐户之间。
  • 事务组具有仅属于该分片ID并且对其唯一的事务。
  • 指定前后状态根。

现在,让我们来看看顶层又是第二层。

二级

什么是以太坊节点和分片?

图片提供:Hackernoon。

别害怕它比看起来更容易理解。

有正常的区块链,但现在它包含两个主要的根:

  • 国家根
  • 事务组根目录

状态根代表整个状态,正如我们之前所见,状态被分解为分片,分片包含它们自己的子状态。

事务组根包含该特定块内的所有事务组。

二级属性

  • 第二级就像一个简单的区块链,它接受交易组而不是交易。
  • 仅当以下情况时,事务组才有效:a)预状态根与全局状态中的分片根匹配。
    b)事务组中的签名都经过验证。
  • 如果事务组进入,则全局状态根成为该特定分片ID的后状态根。

那么跨分片通信是如何发生的呢?

现在,还记得我们岛上的比喻吗?

碎片基本上就像岛屿。那么这些岛屿如何相互沟通?请记住,分片的目的是使许多并行事务同时发生以提高性能。如果以太坊允许随机的交叉分片通信,则会破坏分片的整个目的。

那么跨分片通信需要遵循什么协议?

以太坊选择遵循交叉分片通信的收据范例。看一下这个:

什么是以太坊节点和分片?

图片提供:hackernoon

正如您在此处所看到的,可以通过事务组Merkle root中的多个Merkle树轻松访问每个单独的事务接收。分片中的每个事务都将执行两项操作:

  • 更改它所属的分片的状态
  • 生成收据

这是另一个有趣的信息。收据存储在分布式共享内存中,可以通过其他分片查看,但不能修改。因此,交叉分片通信可以通过这样的收据发生:

什么是以太坊节点和分片?

图片提供:Hackernoon

实施分片有哪些挑战?

  • 需要有一种机制来知道哪个节点实现了哪个分片。这需要以安全有效的方式完成,以确保并行化和安全性。
  • 根据Vlad Zamfir的说法,需要首先实施股权证明,以便更容易分割。
  • 节点在无信任系统上工作,这意味着节点A不信任节点B,无论信任如何,它们都应达成共识。因此,如果将一个特定事务分解为分片并分发到节点A和节点B,则节点A必须提供某种证明机制,以便它们完成对分片的部分工作。

什么是以太坊节点和分片:结论

随着以太坊的扩张并迎来大都市和宁静,分片对他们的成长变得越来越重要。如果以太坊确实计划成为新的互联网,他们需要解决他们的可扩展性问题。他们绝对需要实施和指甲碎片以确保其成长。以太坊激动人心的时刻

AMAZONPOLLY-ONLYAUDIO-START-在本指南中,您将了解以太坊节点和分片的内容。如果您想了解更多信息,请查看我们的区块链价格。如果你去年以加密的形式活跃过,那么你就会知道有一个问题困扰着比特币和以太坊:可扩展性。比特币通过激活Segwit和硬分配到比特币现金来解决这个问题。然而,以太坊正试图以不同的方式解决这个问题。他们希望激活的众多协议中的一个,当它们进入下一阶段的增长时,就是“分片”。在我们理解这意味着什么之前,我们需要彻底了解网络和节点。

培养成为区块链开发者立即开始免费试用什么是以太坊节点和分片?什么是节点,网络和参数?让我们通过简单的日常活动来理解这个概念的含义。 (在我们开始之前,请注意3dBuzz的精彩解释。)想一个框:这个框接受输入,对它们执行某种操作,然后给出输出。这个盒子是一个“节点”。请记住,节点并不完全是“盒子”,我们在这里只使用一个假设的情况。网络是这些节点的集合,它们彼此相互链接。参数是节点绑定的规则。从本质上讲,这就是节点和网络。现在让我们看看通过节点和网络解释的一些简单的日常活动。让我们看看简单的碎纸机是如何工作的。那么,这里发生了什么?你正在使用三个节点:纸张碎纸机和……井……“切碎的东西”。这三个节点构成了“粉碎网络”。让我们有更多的乐趣。到目前为止,我们假设节点只接受一个输入。如果他们采取更多的措施怎么办?我们以烤面包机为例。烤面包机有两个输入:电力面包这就是它的样子:记住一件事,即使其中一个输入缺失,烤面包机也无法工作。现在,是时候把它提升到另一个档次。让我们想一个使用参数的复杂网络。想想你的电视机。您的电视机已连接到您的服务提供商。假设你拥有一个PS4,并且因为你很难做出决定,你也拥有一个Xbox。所以,如果我们要绘制整个“电视网络”,这就是它的样子:呃,哦……我们这里有问题。您只能通过电视访问其中一个节点。你现在不能真正看到权力的游戏和玩神秘海域,你呢?那么,您如何确保您的电视一次只能访问一个节点?这是您引入参数的地方。这些参数使您的节点与众不同。假设您想在电视中添加一个名为“Channel Switcher”的参数。这就是频道切换器的工作原理:如果按“0”,它将显示正常的电视即服务提供商。如果按“1”,则可以访问PS4。如果按“2”,则可以访问Xbox。只需添加这些参数,您就可以创建节点,即电视唯一。那么,让我们来探索一下我们可以给电视带来更多独特的其他参数:尺寸:说,我们的电视是一个55英寸的屏幕。颜色:我们的电视是银灰色的。品牌:我们有索尼电视。类型:我们有等离子屏幕。好的,所以现在由于我们的参数,我们有一个更加明确的电视。现在我们知道我们有一个55英寸,银灰色,等离子屏索尼电视。因此,从我们迄今为止学到的所有内容中,让我们尝试定义节点,网络和参数的含义。节点:接收输入并对其执行功能并输出输出的各个组件。网络:彼此互连的节点集合。参数:定义节点并使其更加独特的规则在电信环境中的节点和网络我们的整个电信系统在网络和节点的基础上工作。您的互联网,电话,短信,每一个工作都是因为精心布局的网络和节点。那么,您如何定义电信网络?根据不列颠百科全书,“电信网络是链接和交易所的电子系统,以及管理其操作的控制,允许多个用户之间的数据传输和交易所。”为什么我们需要电信网络?虽然可以在个人之间进行一对一的连接,但这将是非常昂贵和麻烦的。此外,这将是一个非常无效的过程,因为大多数通信线路将处于闲置状态,未充分利用。为了提高这一过程的效率,我们使用了电信网络。那么,在这种情况下,节点的定义是什么?在此上下文中,节点是重新分发点或通信端点。那么,让我们看一个如何工作的例子。考虑一个简单的GSM网络。假设,Alice想要向Bob发送短信,整个系统将如何运作? (Shoutout到Roviell YouTube频道进行解释)。步骤1:Alice写入消息并按发送。消息转到基站又称BST。 BST将您连接到网络。周围有大量的BST。把它们想象成餐馆里的服务员。你只需举手(发送短信)就可以得到他们的注意力。步骤2:基站控制器(即BSC)确保BST全部有序并且一切都处于工作状态。使用我们的餐厅类比,BSC是“maîtred'hôtel”或服务员,确保每个餐桌都由服务员照看。 (还记得来自Hell's Kitchen的Jean Phillippe吗?是的,那个人。)步骤3:从BSC开始,消息现在转到移动交易所中心又称MSC。它确保数据从站无缝移动到网络,反之亦然。 In our restaurant analogy, the MSC are the head chefs, who take the orders and relay them to the chefs AND also put the finishing touches on the dishes before sending them out. Step 4: Now the message gets sent to the Short Message Service Center aka SMSC. These are the chefs in the analogy. Over here, the message is saved until they get more information about the recipient. The SMSC gets help from sources like the Home Location Register (HLR) and the Visitor Location Register (VLR), these 2 are databases which contain all the information about the network. They basically help track down the sender AND the recipient to see if the message can be sent. They check whether the recipient’s phone is switched off, or if it is out of coverage area etc. If for some reason the message can’t be sent, then it gets stored in the SMSC for a maximum of 6 hours before it gets deleted. Step 5: Now, if the SMS is good to go, the SMSC hands the message over to the recipient’s MSC. Step 6: The SMS goes to the BSC. Step 7: The BSC forwards the message to the BST. Step 8: The BST then finally sends the message to the recipient. So, this is an overview of how the entire SMS system works. The BSC, BST, MSC, SMSC, HLR and VLR are all nodes in the GSM network. This is what the whole thing looks like: What is a Peer-to-Peer Network? A normal network structure is the “client-server” structure. How does that work? There is a centralized server. And everyone who wants to connect with the server can send a query to get the required information. This is pretty much how the internet works. When you want to Google something, you send a query to the Google server, which comes back with the required results. So, this is a client-server system. Now, what is the problem with this model? Since everything is dependent on the server, it is critical for the server to be functioning at all times for the system to work. It is a bottleneck. Now suppose, for whatever reason the main server stops working, everyone in the network will be affected. Plus, there are also security concerns. Since the network is centralized, the server itself handles a lot of sensitive information regarding the clients. This means that anyone can被黑 the server and get those pieces of information. Plus, there is also the issue of censorship. What if the server decides that a particular item (movie, song, book etc.) is not agreeable and decides not to propagate it in their network? So, to counter all these issues, a different kind of network architecture came about. It is a network which partitions its entire workload between participants, who are all equally privileged, called “peers”. There is no longer one central server, now there are several distributed and decentralized peers. This is a peer-to-peer network. Image Courtesy: InfoZones Why do people use the peer-to-peer network? One of the main uses of the peer-to-peer network is file sharing, also called torrenting. If you are to use a client-server model for downloading, then it is usually extremely slow and entirely dependent on the health of the server. Plus, like we said, it is prone to censorship. However, in a peer-to-peer system, there is no central authority, and hence if even one of the peers in the network goes out of the race, you still have more peers to download from. Plus, it is not subject to the idealistic standards of a central system, hence it is not prone to censorship. If we were to compare the two: Image courtesy: Quora The decentralized nature of a peer-to-peer system becomes critical as we move on to the next section. How critical? Well, the simple (at least on paper) idea of combining this peer-to-peer network with a payment system has completely revolutionized the finance industry by giving birth to cryptocurrency. The use of networks and nodes in cryptocurrencies. Let’s take a look at Ethereum’s network structure. Ethereum is structured as a peer-to-peer network, such that the participants aka the peers aka the nodes are not given any extra special privileges. The idea is to create an egalitarian network. The nodes are not given any special privileges, however, their functions and degree of participation may differ. There is no centralized server/entity, nor is there any hierarchy. It is a flat topology. All decentralized cryptocurrencies are structured like that is because of a simple reason, to stay true to their philosophy. The idea is to have a currency system, where everyone is treated as an equal and there is no governing body, which can determine the value of the currency based on a whim. This is true for both bitcoin and Ethereum. Now, if there is no central system, how would everyone in the system get to know that a certain transaction has happened? The network follows the gossip protocol. Think of how gossip spreads. Suppose Alice sent 3 ETH to Bob. The nodes nearest to her will get to know of this, and then they will tell the nodes closest to them, and then they will tell their neighbors, and this will keep on spreading out until everyone knows. Nodes are basically your nosy, annoying relatives. So, what is a node in the context of Ethereum? A node is simply a computer that participates in the Ethereum network. This participation can be in three ways By keeping a shallow-copy of the blockchain aka a Light Client By keeping a full-copy of the blockchain aka a Full Node By verifying the transactions aka挖矿 What is a Light Client? As we have mentioned before, the idea of a peer-to-peer system is to distribute network responsibilities among nodes called “peers”. No preference is given to any one of them. However, what about people who want to take part in the network but don’t have the system resources to download and maintain the full blockchain in their system? They can choose to become “Light clients”. By being a Light Client, they get high-security assurances about certain states of Ethereum and also the power to verify the execution of a transaction. What is a Full Node? Any computer, connected to the Ethereum network, which fully enforces all the consensus rules of Ethereum is called a Full Node. A full node downloads the entire blockchain in the user’s desktop. Full nodes form the backbone of the Ethereum system and keep the entire network honest. Some of the consensus rules that full nodes enforce are: Making sure that the correct block reward is given out for each block mined (5 ETH) Transactions have the correct signatures Transactions and blocks are in the correct data format No double spending is occurring in any of the blocks The full nodes basically validate the nodes and transactions and relay the information to the other nodes (using the gossip protocol). Miners vs Nodes To keep it simple, all miners are full nodes, but not all full nodes are miners. Miners need to be running full nodes to access the blockchain. Anyone who runs a full node need not mine for blocks. What is the scalability problem that Ethereum is facing? How does consensus happen in the Ethereum network? Each and every node in the network does every calculation, and when they all come to a consensus, the transaction is deemed good. Now, this might have worked properly, in the beginning, however, Ethereum has grown very popular and the number of transactions has been steadily increasing. Check out this graph by Etherscan: Image Courtesy: Etherscan Now, even though this is a good thing, the number of calculations that the networks have to go through before they can come to a consensus has increased exponentially as a result. Along with that, there is another problem that has come up. Ethereum has seen widespread adoption because of the backing by certain corporate heavyweights and the popularity of its ICOs. As a result of this, the number of nodes on the Ethereum network has increased exponentially. In fact, it is the cryptocurrency with the most nodes and hence most decentralized. In fact, as of May 2017, Ethereum had 25,000 nodes as compared to Bitcoin’s 7000!! That’s more than 3 times. In fact, the number of nodes from April to May increase by 81%…that’s nearly double! Image Courtesy: Trust Nodes. Now, you may be thinking that having more nodes in the network will help speed up the transaction time. Well… think again. Consensus happens in a linear manner. Meaning, suppose there are 3 nodes A, B and C. For consensus to occur, first A would do the calculations and verify and then B will do the same and then C. However, if there is a new node in the system called “D”, that would add one more node to the consensus system, which will increase the overall time period. As Ethereum has become more popular, the transaction times have gotten slower. In fact, in a speed test, it was seen that Ethereum managed a paltry 20 transactions per second as compared to PayPal’s 193 and Visa’s 1667!! Now remember one thing, Ethereum doesn’t envision themselves to be just mere currency, their ultimate vision is to be something like the new internet. They want people to create DApps on the scale of Facebook and Youtube to run on top of their blockchain. In order for something like this to happen, they will need to do something about their scalability issues. In order to address that, three proposals were raised: Increase the block size Make users use different alt coins Sharding Increase the block size So, one solution is to increase the block size. While this would definitely improve the performance by increasing the number of transactions going into one block, there are several problems that can happen as a result: Firstly, this will still not solve the problem of nodes coming to a consensus at a slower pace. In fact, as the number of transactions per block increases, the number of calculations and verifications per node will increase as well. In order to accommodate for more and more transactions, the block sizes need to be increased periodically. This will centralize the system more because normal computers and users won’t be able to download and preserve such bulky blockchains. This goes against the egalitarian spirit of a blockchain. Finally, block size increase will happen only via硬分叉, which can split the community. The last time a major硬分叉 happened in Ethereum the entire community was divided and two separate currencies came about. People don’t really want this to happen again. Make users use different altcoins. Another proposal was to run parallel blockchains instead of one main blockchain. Basically, instead of making 50 DApps run on one main blockchain, have 2 blockchains and run 25 DApps each. There were two problems with this proposal: It is not wise to split up the hashrate of a chain. The hashrate of the chain after all determines how secure it is from external黑客s and fast the system is. It will be easier for malicious miners to get 51% majority on the smaller chains. Sharding Finally, sharding was decided as the way to go for Ethereum. Before we do a deep dive into sharding let’s gain a simple understanding as to what it means. Suppose there are three nodes A, B and C and they have to verify data T. Instead of A, B and C verifying the entire data T individually, the data will be broken into 3 shards: T1, T2 and T3. After that A, B and C will verify one shard each side-by-side. As you can see the amount of time you are saving is exponential. Anyway, let’s do a deep dive!什么是分片?分片是从数据库系统中获取的术语。让我们看一下分片对数据库的意义。假设您的网站有一个庞大的庞大数据库。拥有庞大的数据库不仅会使数据搜索速度变慢,而且还会妨碍您的可扩展性。那么,在这种情况下你做了什么?如果对数据执行水平分区并将其转换为较小的表并将其存储在不同的数据库服务器上,该怎么办? Image courtesy: Dzone Like so?现在,您可能会问,为什么是水平分区而不是垂直分区? That is because of the way tables are designed: You see?它是相同的表/数据库,但数据较少。这些较小的数据库称为较大数据库的分片。每个分片应该与相同的表结构相同。 Sharding in the context of blockchain Now, as we have seen, the problem with Ethereum consensus is that all the nodes need to do all the calculations and verifications for each and every transaction. This makes the whole process very slow and cumbersome. So, how is sharding going to help this? Consider the state of the Ethereum blockchain which we shall call “Global State”, which is visible to everyone. Let’s consider the Merkle Root of this global state. (For Merkle trees and roots read our article on HASHING). This state root is going to be broken up into shard roots and each of these shared roots is going to have their own state. These states are going to be represented in the form of a Merkle tree. This is a very simple structure of what that is supposed to look like. Now, let’s get into the internal mechanics. So what happens what after sharding is activated? The state is split into shards Each unique account is in one shard Accounts can only transact with other accounts in the same shard In Devcon, Vitalik Buterin explained shards like this: Imagine that Ethereum has been split into thousands of islands. Each island can do its own thing. Each of the island has its own unique features and everyone belonging on that island i.e. the accounts, can interact with each other AND they can freely indulge in all its features. If they want to contact with other islands, they will have to use some sort of protocol. So, the question is, how is that going to change the blockchain? What does a normal block in bitcoin or Ethereum (pre-sharding) look like? So, there is a block header and the body which contains all the transactions in the block. The Merkle root of all the transactions will be in the block header. Now, think about this. Did bitcoin really need blocks? Did it really need a blockchain? Satoshi could have simply made a chain of transactions by including the hash of the previous transaction in the newer transaction, making a “transaction chain” so to speak. The reason why they arrange these transactions in a block is to create one level of interaction and make the whole process more scalable. What Ethereum suggests is that they change this into two levels of interaction. The First Level The first level is the transaction group. Each shard has its own group of a transaction. Image courtesy:黑客noon The transaction group is divided into the transaction group header and the transaction group body. Transaction Group Header The header is divided into distinct left and right parts. The Left Part: Shard ID: The ID of the shard that the transaction group belongs to. Pre-state root: This the state of the root of shard 43 before the transactions were applied. Post state root: This is the state of the root of shard 43 after the transactions are applied. Receipt root: The receipt root after all the transactions in shard 43 are applied. The Right Part: The right part is full of random validators who need to verify the transactions in the shard itself. They are all randomly chosen. Transaction Group Body It has all the transaction IDs in the shard itself. Properties of Level One Every transaction specifies the ID of the shard it belongs to. A transaction belonging to a particular shard shows that it has occurred between two accounts which are native to that particular shard. Transaction group has transactions which belong to only that shard ID and are unique to it. Specifies the pre and post state root. Now, let’s look at the top level aka the second level. The Second Level Image courtesy:黑客noon. Don’t be scared! It is easier to understand than it looks. There is the normal blockchain, but now it contains two primary roots: The state root The transaction group root The state root represents the entire state, and as we have seen before, the state is broken down into shards, which contain their own substates. The transaction group root contains all the transaction groups inside that particular block. Properties Of Level Two Level two is like a simple blockchain, which accepts transaction groups rather than transactions. Transaction group is valid only if:a) Pre-state root matches the shard root in the global state. b) The signatures in the transaction group are all validated. If the transaction group gets in, then the global state root becomes the post-state root of that particular shard ID. So how does cross-shard communication happen? Now, remember our island analogy? The shards are basically like islands. So how do these islands communicate with each other? Remember, the purpose of shards is to make lots of parallel transactions happen at the same time to increase performance. If Ethereum allows random cross-shard communication, then that defeats the entire purpose of sharding. So what protocol needs to be followed for cross-shard communication? Ethereum chose to follow the receipt paradigm for cross-shard communications. Check this out: Image courtesy:黑客noon As you can see here, each individual receipt of any transaction can be easily accessed via multiple Merkle trees from the transaction group Merkle root. Every transaction in a shard will do two things: Change the state of the shard it belongs to Generate a receipt Here is another interesting piece of information. The receipts are stored in a distributed shared memory, which can be seen by other shards but not modified. Hence, the cross-shard communication can happen via the receipts like this: Image courtesy:黑客noon What are the challenges of implementing sharding? There needs to be a mechanism to know which node implements which shard. This needs to be done in a secure and efficient way to ensure parallelization and security. Proof of stake needs to be implemented first to make sharding easier according to Vlad Zamfir. The nodes work on a trustless system, meaning node A doesn’t trust node B and they should both come to a consensus regardless of that trust. So, if one particular transaction is broken up into shards and distributed to node A and node B, node A will have to come up with some sort of proof mechanism that they have finished work on their part of the shard. What are Ethereum Nodes And Sharding: Conclusion As Ethereum expands and ushers in Metropolis and Serenity, sharding becomes more and more critical to their growth. If Ethereum does plan on becoming the new internet, they need to fix their scalability issues. They absolutely need to implement and nail sharding to ensure their growth. Exciting times lie ahead for Ethereum! -AMAZONPOLLY-ONLYAUDIO-END-

资讯来源:由0x资讯编译自BLOCKGEEKS。原文链接:https://blockgeeks.com/guides/what-are-ethereum-nodes-and-sharding/,版权归作者所有,未经许可,不得转载
提示:投资有风险,入市需谨慎,本资讯不作为投资理财建议。请理性投资,切实提高风险防范意识;如有发现的违法犯罪线索,可积极向有关部门举报反映。
你可能还喜欢