duanduo3712 2018-06-20 02:52
浏览 654

实例化链码时出错

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

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

MyChainCode:

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)
...

My packages

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
}

Issue:

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

Fabric ver 1.1.0

Go ver 1.9.2

  • 写回答

3条回答 默认 最新

  • duanhuai7532 2018-06-21 19:10
    关注

    That can be because you have old version in some files inside your hyperledger/fabric folder.

    If you are following the chaincode tutorial, you can just remove your hyperledger/fabric folder.

    Regards

    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?