实例化链码时出错 [英] Error when instantiate chaincode

查看:287
本文介绍了实例化链码时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我解决这个问题,当我实例化我的链码时发生错误:

Please help me this issue, error happened when I instantiate my chaincode:

当前,我猜是与shim软件包有关的问题,因为我已将其删除到utils软件包中,成功实例化了.

Currently, I guess the issue related to shim package, because I remove it in my utils package, instantiate successfully.

import (
    "bytes"
    "encoding/hex"
    "encoding/json"
    "fmt"
    "strconv"

    "github.com/golang/protobuf/proto"
    "github.com/hyperledger/fabric/core/chaincode/shim"
    "github.com/hyperledger/fabric/protos/msp"
    pb "github.com/hyperledger/fabric/protos/peer"
    "github.com/myproj/models"
    "github.com/myproj/packages/utils"
)

APIstub shim.ChaincodeStubInterface
...
username, _ = utils.GetCurrentUser(APIstub)
...

我的包裹

package utils

import (
    "github.com/hyperledger/fabric/core/chaincode/shim"
    "golang.org/x/crypto/bcrypt"
)

func GetCurrentUser(stub shim.ChaincodeStubInterface) (string, error) {
    cert, err := GetCreatorCert(stub)

    return cert.Subject.CommonName, err
}

问题:

错误:认可链码时出错:rpc错误:代码=未知desc = 错误启动容器:无法生成特定于平台的泊坞窗 内部版本:从内部版本返回错误:2# 〜vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive 〜vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:5: hdr.Format未定义(* tar.Header类型没有字段或方法格式) 〜vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:15: 未定义:tar.FormatPAX 〜/vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:7: hdr.Format未定义(* tar.Header类型没有字段或方法格式) 〜/vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:17: 未定义:tar.FormatPAX

Error: Error endorsing chaincode: rpc error: code = Unknown desc = error starting container: Failed to generate platform-specific docker build: Error returned from build: 2 "# ~vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive ~vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:5: hdr.Format undefined (type *tar.Header has no field or method Format) ~vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:364:15: undefined: tar.FormatPAX ~/vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:7: hdr.Format undefined (type *tar.Header has no field or method Format) ~/vendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/archive/archive.go:1166:17: undefined: tar.FormatPAX

织物版本1.1.0

转到1.9.2版

推荐答案

将结构升级到1.2.0后,我遇到了同样的问题. Fabric 1.2.0需要go1.10.x.所以我将go lang升级到1.10.3,它像一个魅力一样工作.

I faced the same problem after upgrading fabric to 1.2.0. Fabric 1.2.0 requires go 1.10.x. So I upgraded go lang to 1.10.3 and it worked like a charm.

这篇关于实例化链码时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆