50 Matching Annotations
  1. Feb 2020
    1. 说句实话,工程上来说,和hash比起来,trie就是没有用的东西。这个可以说很深刻地表现出了一个学生和一个软件工程师的思维差异。你可能很清楚,hash类的算法都有可能因为碰撞而退化,而trie是稳定的复杂度,简直太招人喜欢了。但是工程师99.9%的情况下都会用hash。因为,hash函数、map、set,都有内置库,所有语言都有。这意味着一个功能用hash就是五行代码,甚至体现不出用了hash,而用trie,你要么先交一份trie开源库的分析选型比较报告来,要么自己撸一个,附带着先写一千行的单元测试用例,再跑个压测。万一将来换个语言,请从头再来。是的,就是这么简单,工程师才不会考虑碰撞,他们甚至不关心rehash、hash实现这些细节,许多语言内置的hash实现已经考虑了防止恶意碰撞了,而随机碰撞,没有那么巧的事情。写出简单可用能快速上线的代码要更重要。你看出来了,学术关心理论最优,工程关心实践最优。你可能愤愤不平,为啥标准库不把trie加进去?那你有没有想过这些问题呢?1. 如果字符串不是常见的英文小写字母,而是unicode呢?2. 如果这些字符串超级长,甚至有傻子拿来了一千个文本文件,每个有100KB呢?3. 字符串现在多得不能忍了,需要分布式处理,你要怎么设计一个分布式的trie(要记得trie的节点分布可能是高度不均衡的)?所以,工程看重什么也是有道理的。当然trie自然不是真的没用,它支持前缀匹配,支持范围查找,这些都有独特的应用,比如数据库里字符串类型的索引就经常实现为前缀树(另一种常见实现自然就是hash)。但说实话,不会有工程师认为这是两种可以相互竞争的技术。

      通透

    1. 从创世区块开始,无尽的交易不断的刷新着系统当前状态,每产生一个区块就对当前状态做一次快照(patricia trie根)存入区块头中。

      这句总结的不错,区块即快照

    1. 我们选取了Snappy来实现数据包压缩和解压功能

      snappy不是为了最大压缩率,或者对其他压缩库的兼容性;而是为了高速度压缩。 It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. 对比最快的zlib,snappy要大20%到100%。 For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger.

  2. Jan 2020
    1. 智能合约执行过程产生的状态数据,经过共识机制确认,分布式的保存在各节点上,数据全局一致,可验证难篡改,所以称为“世界状态”。

      理解有点困难

    1. 世界状态的存储从原来的MPT存储结构转为分布式存储,避免了世界状态急剧膨胀导致性能下降的问题;

      深度融合分布式存储

    2. 各群组独立执行共识流程,由群组内参与者决定如何进行共识,一个群组内的共识不受其他群组影响,各群组拥有独立的账本

      单独共识

    1. 分布式存储定义了标准的数据访问CRUD接口,可以适配多种存储系统,同时支持SQL和NoSQL两种数据管理方式

      是否支持智能合约访问数据?

    2. 实现群组架构,在多个节点组成的一个全局网络中,可以存在多个节点子集组成的子网络,这些子网络维护一个独立的账本。

      类似于Fabric通道技术

    1. Indeed, the ordering service nodes operate a mini-blockchain, connected via the system channel we mentioned earlier. Using the system channel ordering service nodes distribute network configuration transactions. These transactions are used to co-operatively maintain a consistent copy of the network configuration at each ordering service node. In a similar way, peer nodes in an application channel can distribute channel configuration transactions. Likewise, these transactions are used to maintain a consistent copy of the channel configuration at each peer node.

      事实上,排序服务内部运行着一个mini区块链,通过系统通道进行连接。通过系统通道,排序服务分发配置交易。这些交易用来维护网络配置。类似的,应用通道的节点也以此方式分发通道配置。 这些交易用来保证每个节点上有一套配置的副本。

    2. Both network and channel configurations are kept consistent using the same blockchain technology that is used for user transactions – but for configuration transactions. To change a network or channel configuration, an administrator must submit a configuration transaction to change the network or channel configuration. It must be signed by the organizations identified in the appropriate policy as being responsible for configuration change. This policy is called the mod_policy and we’ll discuss it later.

      网络,通道配置使用与用户交易同一种技术进行修改,交配置交易。 为了修改网络或通道配置,管理员必须提交配置交易。这个交易必须由策略对应的组织验证。

    3. It means that although ordering service node O4 is the actor that created consortia X1 and X2 and channels C1 and C2, the intelligence of the network is contained in the network configuration NC4 that O4 is obeying. As long as O4 behaves as a good actor, and correctly implements the policies defined in NC4 whenever it is dealing with network resources, our network will behave as all organizations have agreed. In many ways NC4 can be considered more important than O4 because, ultimately, it controls network access.

      说的比较乱,NC4比O4重要;

    4. We can see that network and channel configurations are logically singular – there is one for the network, and one for each channel. This is important; every component that accesses the network or the channel must have a shared understanding of the permissions granted to different organizations.

      网络配置,通道配置 逻辑上是单一的,网络独一份,每个通道一份。 访问网络或通道必须有对应授权。

      尽管逻辑上配置只有一份,但是实际物理上市分布式存储的。 比如网络节点P1,P2都有通道配置CC1的备份;P2,P3拥有通道配置CC2的备份。 相似的,排序服务O4拥有网络配置,在多节点配置中,每个排序服务都有网络配置。

    5. It is managed exclusively by R2 and R3; R1 and R4 have no power in channel C2.

      通道C2只有R2和R3能管,NC4的R1和R4管不着,层级很明确,不能越级访问。 举例就是如果要给C2通道增加新组织,只有R2,R3能做。

    6. A new channel can only be created by those organizations specifically identified in the network configuration policy, NC4, as having the appropriate rights to do so, i.e. R1 or R4.

      只有被网络配置认可的组织才能创建新的通道,样例中,NC4中的R1和R4有这个权利。 这个策略将能够管理网络资源与管理通道资源分离开来。 hyperledger拥有复杂的分层策略。

    7. It all means that it is possible to configure sophisticated topologies which support a variety of operational goals – there is no theoretical limit to how big a network can get. Moreover, the technical mechanism by which peers within an individual organization efficiently discover and communicate with each other – the gossip protocol – will accommodate a large number of peer nodes in support of such topologies.

      号称能支持大规模网络,通过gossip协议进行支撑,表示怀疑

    8. We can see that the careful addition of peers to the network can help support increased throughput, stability, and resilience. For example, more peers in a network will allow more applications to connect to it; and multiple peers in an organization will provide extra resilience in the case of planned or unplanned outages.

      增加节点能够增加吞吐量,可靠性,弹性。比如,更多节点能够支持更多客户端;组织内部的多节点能够在计划内或计划外的断电down机情况能够提供更多弹性。

    9. Copies of smart contract S5 will usually be identically implemented using the same programming language, but if not, they must be semantically equivalent.

      智能合约还可以是不同语言编写,但要求完全一致

    10. However, if R2 wanted to change the chaincode definition, both R1 and R2 would need to approve a new definition for their organization, and then one of the organizations would need to commit the definition to the channel.

      如果R2想修改链码的定义,则R1和R2组织必须都同意,然后由其中一个组织提交链码定义到channel

    11. A new organization can use the chaincode as soon as they approve the chaincode parameters agreed to by other members of the channel.

      新组织必须同意链码的参数(不是智能合约么)才能使用链码。 因为链码的同意发生在组织的层级,R2可以只同意链码定义一次,然后加入多个节点。

    12. It’s more the case that peer nodes with smart contracts have a special power – to help generate transactions. Note that all peer nodes can validate and subsequently accept or reject transactions onto their copy of the ledger L1.

      安装了智能合约的节点拥有生成交易(区块?)的能力。 所有节点都能验证交易,接收或者拒绝交易记录在自身账本。 但是只有安装智能合约的节点才能参与交易背书,这事合法交易生成的核心要素。

    13. A peer can only run a smart contract if it is installed on it, but it can know about the interface of a smart contract by being connected to a channel.

      大型网络里面不是每个节点都安装了智能合约,只有安装了的节点才能运行,但所有节点都能通过连接通道来查看合约接口。

    14. Note that a peer can be a committing peer, endorsing peer, leader peer and anchor peer all at the same time! Only the anchor peer is optional – for all practical purposes there will always be a leader peer and at least one endorsing peer and at least one committing peer.

      一个节点可以同时是提交节点,背书节点,leader节点,锚节点。其中锚节点是可选的,实际环境应该有一个leader节点,至少一个提交节点,至少一个背书节点。

    15. If a peer needs to communicate with a peer in another organization, then it can use one of the anchor peers defined in the channel configuration for that organization.

      跨组织通信使用锚节点

    16. For the static set, zero or more peers can be configured as leaders. For the dynamic set, one peer will be elected leader by the set. Moreover, in the dynamic set, if a leader peer fails, then the remaining peers will re-elect a leader.

      静态选举方式可以选择多个,动态选举方式只能选举一个

    17. When an organization has multiple peers in a channel, a leader peer is a node which takes responsibility for distributing transactions from the orderer to the other committing peers in the organization.

      主节点用来发布交易,是通过选举得出;每个组织都有自己的主节点,节点自身可以决定是否参与选举。

    18. Client applications do this by sending transaction proposals to peers owned by the organizations specified by the smart contract endorsement policy. The transaction proposal serves as input to the smart contract, which uses it to generate an endorsed transaction response, which is returned by the peer node to the client application.

      发起事务请求,作为输入进行验证

    19. It describes which organizations must approve transactions before they will be accepted by other organizations onto their copy of the ledger.

      背书策略,链码可以选择;描述了必须哪些组织角色背书,交易才能执行

    20. A sufficient number of organizations need to approve a chaincode definition (A majority, by default) before the chaincode definition can be committed to the channel and used to interact with the channel ledger.

      必须有多数组织同意才能部署链码

    21. When an organization has multiple peers in a channel, it can choose the peers upon which it installs smart contracts;

      每个组织选一个peer?peer可以看实现细节,怎么达成共识呢?

    22. note that R4 cannot add itself to the channel C1 – it must, and can only, be authorized by R1 or R2.

      网络管理员R4也不能把自己加到渠道,必须渠道内部的R1和R2授权

    23. Ordering services are usually multi-node, and can be configured to have different nodes in different organizations.

      排序服务多节点多组织部署

    1. a specific user ID could be permitted to invoke a chaincode application, but be blocked from deploying new chaincode

      可以执行,但不能部署

    1. To improve upon its privacy and confidentiality capabilities, Fabric has added support for private data and is working on zero knowledge proofs (ZKP) available in the future. More on this as it becomes available.

      fabric还不支持私密数据??

    2. This design departs radically from the order-execute paradigm in that Fabric executes transactions before reaching final agreement on their order.

      达成共识前执行

    3. One of the most important of the platform’s differentiators is its support for pluggable consensus protocols that enable the platform to be more effectively customized to fit particular use cases and trust models.

      这个貌似只有RAFT,PBFT还不支持啊

    4. in such a permissioned context, the risk of a participant intentionally introducing malicious code through a smart contract is diminished

      许可进入网络参与者引入病毒代码的风险降低,可以这么说,但不能太绝对。