Hyperledger fabric 在Hyperledger Fabric 1.1.0中实例化链码时出错
我正在尝试在Hyperledger Fabric peer 1.1.0中实例化链码。我已经下载了1.1.0版本的fabric示例和docker容器。fabcar应用程序已成功实例化 但是,当我实例化我的链码时,对等方退出,并出现以下错误Hyperledger fabric 在Hyperledger Fabric 1.1.0中实例化链码时出错,hyperledger-fabric,Hyperledger Fabric,我正在尝试在Hyperledger Fabric peer 1.1.0中实例化链码。我已经下载了1.1.0版本的fabric示例和docker容器。fabcar应用程序已成功实例化 但是,当我实例化我的链码时,对等方退出,并出现以下错误 2019-06-29 12:01:47.916 UTC [kvledger] CommitWithPvtData -> INFO 042 Channel [mychannel]: Committed block [3] with 1 transaction
2019-06-29 12:01:47.916 UTC [kvledger] CommitWithPvtData -> INFO 042 Channel [mychannel]: Committed block [3] with 1 transaction(s)
panic: assignment to entry in nil map
goroutine 569 [running]:
github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.createCouchdbDocJSON(0xc422170890, 0x6, 0x0, 0x0, 0xc422170898, 0x4, 0x4, 0xc422170ae0, 0xc42001e000, 0xc42001e070, ...)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:984 +0x1d8
github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*VersionedDB).processUpdateBatch(0xc4215691d0, 0xc4217c7df0, 0x0, 0x0, 0x0, 0xc422170898, 0x4)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:669 +0x550
github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*VersionedDB).ApplyUpdates.func1(0xc422170eb0, 0xc42000eb68, 0xc4215691d0, 0xc422197140, 0xc422170870, 0x7)
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:577 +0x8a5
created by github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb.(*VersionedDB).ApplyUpdates
/opt/gopath/src/github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb.go:509 +0x11d
正如我在上面所看到的,它不是从$GOPATH(即/home/ubuntu/software/golang)获取go代码
我已经使用命令安装了结构和示例
如中所述
传递参数“1.1.0 1.1.0 0.4.15”
我可以看到chaincodeinit方法是从应用程序日志中执行的
func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
fmt.Println("Init firing.")
// Initialize the collection of commercial paper keys
fmt.Println("Initializing user accounts")
//t.createUser(stub, []string{"importerBank", "importerBank", "Importer Bank"})
//t.createUser(stub, []string{"customs", "customs", "Customs"})
//t.createUser(stub, []string{"exporterBank", "exporterBank", "Exporter Bank"})
//t.createUser(stub, []string{"exporter", "exporter", "Exporter"})
fmt.Println("Initializing LC keys collection if not present")
valAsbytes, err := stub.GetState("LCKeys")
if err == nil {
var keys []string
err = json.Unmarshal(valAsbytes, &keys)
fmt.Println("Existing LC : %v", keys);
if len(keys) > 0 {
for _, key := range keys {
valAsbytes, err := stub.GetState(key)
if err == nil {
var lc LC
err = json.Unmarshal(valAsbytes, &lc)
if err == nil {
if lc.CurrentStatus == "" {
lc.CurrentStatus = "Created"
keysBytesToWrite, _ := json.Marshal(lc)
if err == nil {
err = stub.PutState(key, keysBytesToWrite)
if err != nil {
fmt.Println("Error writing LC to chain" + err.Error())
}
}
}
}
}
}
}
}
fmt.Println("Initialization complete")
- 订购方\常规\日志级别=调试
- 订购方\常规\列表地址=0.0.0.0
- 订购方\常规\基因方法=文件
- 订购方\常规\基因文件=/etc/hyperledger/configtx/genesis.block
- 订购方\常规\本地MSPID=OrderMSP
- 订购方\一般\本地MSPDIR=/etc/hyperledger/msp/order/msp
- GODEBUG=netdns=go 工作目录:/opt/gopath/src/github.com/hyperledger/fabric/order 命令:订购者 端口:
- 7050:7050
卷数:
- ./config/:/etc/hyperledger/configtx
- ./crypto-config/orderOrganizations/example.com/orders/order.example.com/:/etc/hyperledger/msp/order
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/msp/peerOrg1 网络:
- 基本的
尝试在docker compose文件的环境部分为每个对等方和订购方添加
-GODEBUG=netdns=go
。您不能显示docker compose文件中的内容。已成功实例化链码!你是一个救命恩人。你能用正确的格式显示错误吗?读起来很难,就像我为peer粘贴了docker-composer.yml配置一样。这是和以前一样的错误。“panic:assignment to entry in nil map”是yaml文件的一半,不是完整的文件。我无法附加它。让我粘贴整个文件。