Hyperledger Fabric - 如何更改链代码的集合配置?
Hyperledger Fabric - How to change collection config for chaincode?
我正在使用 Hyperledger Fabric 及其私有数据功能。 collection-config.json
的例子是:
[
{
"name": "collectionMarbles",
"policy": "OR('Org1MSP.member', 'Org2MSP.member')",
"requiredPeerCount": 0,
"maxPeerCount": 3,
"blockToLive":1000000
},
{
"name": "collectionMarblePrivateDetails",
"policy": "OR('Org1MSP.member')",
"requiredPeerCount": 0,
"maxPeerCount": 3,
"blockToLive":3
}
]
使用此配置,"collectionMarblePrivateDetails"
下的数据只能由 Org1MSP.member
访问。
现在我只想将辅助功能更改为 Org2MSP.member
。是否可以做类似$ peer chaincode upgrade --collections-config $GOPATH/src/github.com/chaincode/marbles02_private/collections_config.json
的事情来更新收集策略? (尝试过,但还没有成功)
根据面料 private data documentation:
If a collection is referenced by a chaincode, the chaincode will use
the prior collection definition unless a new collection definition is
specified at upgrade time. If a collection configuration is specified
during the upgrade, a definition for each of the existing collections
must be included, and you can add new collection definitions.
Collection updates becomes effective when a peer commits the block
that contains the chaincode upgrade transaction. Note that collections
cannot be deleted, as there may be prior private data hashes on the
channel’s blockchain that cannot be removed.
是的,可以通过升级链代码来更新私有数据收集成员资格。
这是我用来安装第二个链代码版本然后使用新集合配置在频道上升级它的语法:
peer chaincode install -n marblesp -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02_private -v 2
peer chaincode upgrade -C mychannel -n marblesp -c '{"Args":["init"]}' -v 2 -o 127.0.0.1:7050 --collections-config collection.json
您似乎错过了一些升级标志。
任何新添加的成员都将收到用于未来交易的私人数据。任何已删除的成员将停止接收未来交易的私人数据。
请注意,从 Fabric v1.4 开始,任何新添加的私有数据集合成员也将通过协调过程自动接收先前提交给私有数据集合的私有数据。
我正在使用 Hyperledger Fabric 及其私有数据功能。 collection-config.json
的例子是:
[
{
"name": "collectionMarbles",
"policy": "OR('Org1MSP.member', 'Org2MSP.member')",
"requiredPeerCount": 0,
"maxPeerCount": 3,
"blockToLive":1000000
},
{
"name": "collectionMarblePrivateDetails",
"policy": "OR('Org1MSP.member')",
"requiredPeerCount": 0,
"maxPeerCount": 3,
"blockToLive":3
}
]
使用此配置,"collectionMarblePrivateDetails"
下的数据只能由 Org1MSP.member
访问。
现在我只想将辅助功能更改为 Org2MSP.member
。是否可以做类似$ peer chaincode upgrade --collections-config $GOPATH/src/github.com/chaincode/marbles02_private/collections_config.json
的事情来更新收集策略? (尝试过,但还没有成功)
根据面料 private data documentation:
If a collection is referenced by a chaincode, the chaincode will use the prior collection definition unless a new collection definition is specified at upgrade time. If a collection configuration is specified during the upgrade, a definition for each of the existing collections must be included, and you can add new collection definitions.
Collection updates becomes effective when a peer commits the block that contains the chaincode upgrade transaction. Note that collections cannot be deleted, as there may be prior private data hashes on the channel’s blockchain that cannot be removed.
是的,可以通过升级链代码来更新私有数据收集成员资格。
这是我用来安装第二个链代码版本然后使用新集合配置在频道上升级它的语法:
peer chaincode install -n marblesp -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02_private -v 2
peer chaincode upgrade -C mychannel -n marblesp -c '{"Args":["init"]}' -v 2 -o 127.0.0.1:7050 --collections-config collection.json
您似乎错过了一些升级标志。
任何新添加的成员都将收到用于未来交易的私人数据。任何已删除的成员将停止接收未来交易的私人数据。
请注意,从 Fabric v1.4 开始,任何新添加的私有数据集合成员也将通过协调过程自动接收先前提交给私有数据集合的私有数据。