【问题标题】:Fabric v1.3 chaincode could not instantiate while import 'shim/ext/statebased'Fabric v1.3 链码在导入“shim/ext/statebased”时无法实例化
【发布时间】:2018-12-18 16:15:19
【问题描述】:

由于我尝试了 Fabric v1.3 的新功能:key-level-endorsement 从此 doc,我必须通过 KeyEndorsementPolicy.Policy() 函数生成我的密钥级背书策略。

但是,我在导入包github.com/hyperledger/fabric/core/chaincode/shim/ext/statebased后无法实例化链码

以下是错误日志:

2018-12-11 09:58:25.518 UTC [dockercontroller] deployImage -> ERRO 053 Error building images: Failed to generate platform-specific docker build: Error returned from build: 1 "opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/ext/statebased/statebasedimpl.go:14:2: cannot find package "github.com/hyperledger/fabric/common/cauthdsl" in any of:
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/hyperledger/fabric/common/cauthdsl (vendor tree)
    /opt/go/src/github.com/hyperledger/fabric/common/cauthdsl (from $GOROOT)
    /chaincode/input/src/github.com/hyperledger/fabric/common/cauthdsl (from $GOPATH)
    /opt/gopath/src/github.com/hyperledger/fabric/common/cauthdsl
"

我知道这意味着 ccenv 容器缺少这种依赖,所以我尝试将我的 gopath 下的 vendor 目录添加到我的实例化请求的链码路径目录。然后我又试了一次,还是报错:

2018-12-12 02:06:32.976 UTC [endorser] callChaincode -> INFO 092 [channelforkvepdemo][75cd50e5] Exit chaincode: name:"lscc"  (34907ms)
2018-12-12 02:06:32.976 UTC [endorser] SimulateProposal -> ERRO 093 [channelforkvepdemo][75cd50e5] failed to invoke chaincode name:"lscc" , error: Failed to generate platform-specific docker build: Error returned from build: 2 "# github.com/chaincode/vendor/golang.org/x/crypto/sha3
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go:13:6: missing function body
# github.com/chaincode/vendor/golang.org/x/sys/unix
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go:13:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_linux_gc.go:10:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_linux_gc.go:14:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_unix_gc.go:12:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_unix_gc.go:13:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_unix_gc.go:14:6: missing function body
chaincode/input/src/github.com/chaincode/vendor/golang.org/x/sys/unix/syscall_unix_gc.go:15:6: missing function body
"
error starting container

我怀疑ccenv 图像中仍然缺少一些 c/c++ 库。

那么,如果没有这个KeyEndorsementPolicy,我如何生成密钥级背书策略[]byte?或者,我怎样才能导入这个shim/ext/statebased 包?

【问题讨论】:

    标签: hyperledger-fabric


    【解决方案1】:

    这是由于 fabric-sdk-node 的一个错误,这里是 link。

    升级到fabric-client@1.3.0后,问题解决了:

    npm install fabric-client@1.3.0
    npm install fabric-ca-client@1.3.0
    

    【讨论】:

      猜你喜欢
      • 2018-09-27
      • 1970-01-01
      • 2019-11-11
      • 1970-01-01
      • 1970-01-01
      • 2020-04-05
      • 2019-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多