Hyperledger fabric 如何在Hyperledger结构中实现和部署可插拔ESCC或VSCC策略?

Hyperledger fabric 如何在Hyperledger结构中实现和部署可插拔ESCC或VSCC策略?,hyperledger-fabric,Hyperledger Fabric,我想在当前现有的VSCC和ESCC中分别添加一些额外的验证和认可逻辑。有关于如何编辑自定义VSCC和ESCC并将其部署到Hyperledger结构的文档吗?VSCC和ESCC是系统链码,界面与链码完全相同,因此请查看链码文档或转到。您可以添加自己的验证系统链码,并将其与链码关联 系统链码是使用对等可执行文件构建的,不经过事务性安装/实例化过程。它是在对等机启动时加载的,因此需要在core/scc/importsysccs.go中进行一些注册。查看systemChaincodes变量,您可以看到其

我想在当前现有的VSCC和ESCC中分别添加一些额外的验证和认可逻辑。有关于如何编辑自定义VSCC和ESCC并将其部署到Hyperledger结构的文档吗?

VSCC和ESCC是系统链码,界面与链码完全相同,因此请查看链码文档或转到。您可以添加自己的验证系统链码,并将其与链码关联


系统链码是使用对等可执行文件构建的,不经过事务性安装/实例化过程。它是在对等机启动时加载的,因此需要在core/scc/importsysccs.go中进行一些注册。查看systemChaincodes变量,您可以看到其他变量是如何注册的

所有系统链码,特别是VSCC和ESCC,应实现接口:

// Chaincode interface must be implemented by all chaincodes. The fabric runs
// the transactions by calling these functions as specified.
type Chaincode interface {
    // Init is called during Instantiate transaction after the chaincode container
    // has been established for the first time, allowing the chaincode to
    // initialize its internal data
    Init(stub ChaincodeStubInterface) pb.Response

    // Invoke is called to update or query the ledger in a proposal transaction.
    // Updated state variables are not committed to the ledger until the
    // transaction is committed.
    Invoke(stub ChaincodeStubInterface) pb.Response
}
目前,所有系统链码都静态编译为对等代码并在文件中列出。此外,必须在chaincode节内的文件中启用它们,例如:

chaincode:

    # system chaincodes whitelist. To add system chaincode "myscc" to the
    # whitelist, add "myscc: enable" to the list below, and register in
    # chaincode/importsysccs.go
    system:
        cscc: enable
        lscc: enable
        escc: enable
        vscc: enable
        qscc: enable
接下来,您将实例化您的链码,并希望提供定制的VSCC和ESCC,您需要在LSCC中提供它们的名称。例如,如果要使用peer cli,则可以按以下方式执行:

peer chaincode instantiate -o localhost:7050 -n myCC -v 1.0 -C mychannel -c '{"Args": ["init"]}' --vscc myVSCC --escc myESCC

你能告诉我这个importsysccs.go文件存在于哪里吗?@KartikChauhan,importsysccs.go在源代码树@KartikChauhan中,但是,自从我提供了上面的答案以来,它已经改变了很多。有一种新的机制可以使用Go插件来编写系统链码。如果您不想使用Go插件系统链码,请查看此处的文档,了解如何实现和注册
qscc
。您可以在这里找到
qscc