Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
319 views
in Technique[技术] by (71.8m points)

go - Error when instantiate chaincode

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...