hyperledger fabric(二)

Architecture Explained

//TODO

Transaction Flow

  • 每一个用户(client)都有一个peer,通过这个peer与账本交互
  • 用户需要registe && enroll获得数字证书
  • chaincode(包含初始市场情况)安装在peer上,并在通道上instantiated,需要指定endorsement policy(这里假定peerA和peerB)
  • 假设用户A发起交易(含A的签名),则交易被送至peerA和peerB 为之签名背书

    格式正确

    之前没有被提交

    确认A签名有效(这里用到MSP)

    确认A在此通道是否有写的权利

  • A收到peerA和peerB的response,检查是否相同.如果是查询则到此交易就完成了.如果是修改操作,那么A将交易(包含交易的读写集.背书节点的签名.通道ID)发给orderer

  • orderer收到所有通道来的交易,进行排序,然后送至leading peer, leading peer转发至同一Organization下的其它peer,用gossip协议
  • peer检查背书有效性,并检查读集合是否被修改过,标记交易是否有效
  • peer将block追加至当前通道的chain,有效的交易的写集合被提交到当前state database.发送信号通知A交易被添加到了chain,并告知A交易是否有效

Hyperledger Fabric CA’s User Guide

//TODO

Hyperledger Fabric SDKs

目前:Node,Java

Service Discovery

大概就是说app动态获取需要的信息,比如

Configuration query: Returns the MSPConfig of all organizations in the channel along with the orderer endpoints of the channel.

Peer membership query: Returns the peers that have joined the channel.

Endorsement query: Returns an endorsement descriptor for given chaincode(s) in a channel.

Local peer membership query: Returns the local membership information of the peer that responds to the query. By default the client needs to be an administrator for the peer to respond to this query.

Channel

创建channel:

调用system chaincode 创造 genesis block,其中包含:channel policy;Organization;anchor peers

可能还需要选举leading peer

CouchDB as the State Database

需要复杂查询时再考虑?

Private Data

//TODO

Read-Write set semantics

当peer最后检查交易是否有效时,如果读集合版本和world state的版本不一致,则本次交易无效.

写集合忽视版本直接覆盖即可.

Gossip data dissemination protocol

每个组织有leading peer 和 anchor peer.

leading peer用户organization内传播block

Anchor peer用于同一通道内不同组织间传播block,定义在通道配置中(channel configuration)

leading peer 可静态配置,也可动态选举产生. 稳定状态下只有一个leading peer.

静态配置:

peer:
    # Gossip related configuration
    gossip:
        useLeaderElection: false
        orgLeader: true

动态选举:


peer:
    # Gossip related configuration
    gossip:
        useLeaderElection: true
        orgLeader: false


peer:
    # Gossip related configuration
    gossip:
        election:
            leaderAliveThreshold: 10s

原文

猜你喜欢

转载自blog.csdn.net/yijiull/article/details/81118075