什么是Hyperledger Fabric中configtx yaml中的“策略”?

时间:2019-01-23 06:09:02

标签: hyperledger-fabric

我正在尝试通过参考“结构样本”中提供的“基本网络”和“第一网络”来创建自己的结构网络。

我在“ configtx” yaml文件中遇到了“策略”部分。

请帮助我理解本节的意义。

1 个答案:

答案 0 :(得分:0)

策略基本上是控制通道内访问控制的规则/定义。它们有两种类型

  1. 签名-您可能已经看过这种策略(使用AND,OR等术语,并且比隐式元策略更灵活)
  2. 隐式元-灵活性较差(使用ANY,MAJORITY等术语)

示例 1.签名    组织:

- &Orderer
    Name: Orderer

    # ID to load the MSP definition as
    ID: OrdererMSP
    MSPDir: crypto-config/ordererOrganizations/example.com/msp
    Policies:
       #THIS IS WHERE YOU DEFINE THEM
       # SIGNATURE POLICIES USE TERMS LIKE OR,AND,NOutOf etc.
        Readers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('OrdererMSP.admin')"
  1. 隐含元

应用程序:&ApplicationDefaults

# Organizations is the list of orgs which are defined as participants on
# the application side of the network
Organizations:

# Policies defines the set of policies at this level of the config tree
# For Application policies, their canonical path is
#   /Channel/Application/<PolicyName>
# ImplicitMeta Policy types use ANY,Majority etc.
Policies:
    Readers:
        Type: ImplicitMeta
        Rule: "ANY Readers"
    Writers:
        Type: ImplicitMeta
        Rule: "ANY Writers"
    Admins:
        Type: ImplicitMeta
        Rule: "MAJORITY Admins"

您可以在超级账本结构上阅读有关文档的更多信息,请阅读文档:-https://hyperledger-fabric.readthedocs.io/en/release-1.3/policies.html