我正在跟踪GitHub上的结构样本-余额转移项目
我能够逐步设置链代码,并在节点中使用其提供的示例链代码查询交易。
我想在github.com/目录中包含我自己的自定义链代码,我能够通过提供curl命令来安装链代码
curl -s -X POST \
> http://localhost:4000/chaincodes \
> -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NTkxNTU3NzIsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1NTkxMTk3NzJ9.52cwFysSFcADjvGUtri-hBSERhj2lz3MiGNk8yvBT-Q" \
> -H "content-type: application/json" \
> -d '{
> "peers": ["peer1","peer2"],
> "chaincodeName":"mycc",
> "chaincodePath":"github.com/car-trade",
> "chaincodeVersion":"v0"
> }'
我能够收到消息 在组织org1上成功安装了链码
但是当我使用curl命令实例化链代码时
curl -s -X POST \
> http://localhost:4000/channels/mychannel/chaincodes \
> -H "authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NTkxNTU3NzIsInVzZXJuYW1lIjoiSmltIiwib3JnTmFtZSI6Im9yZzEiLCJpYXQiOjE1NTkxMTk3NzJ9.52cwFysSFcADjvGUtri-hBSERhj2lz3MiGNk8yvBT-Q" \
> -H "content-type: application/json" \
> -d '{
> "chaincodeName":"mycc",
> "chaincodeVersion":"v0",
> "args":["a","100","b","200"]
> }'
我收到一条错误消息 无法发送实例化投标或接收有效响应。响应为空或状态不是200。正在退出...
当我尝试将我在链代码API中得到的响应记录在文件here中时。
const results = await channel.sendInstantiateProposal(request);
proposalResponses.forEach((pr: ProposalResponse) => {
console.log(pr);
}
我收到消息,
{ Error: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "can't load package: package github.com/car-trade: cannot find package "github.com/car-trade" in any of:
/opt/go/src/github.com/car-trade (from $GOROOT)
/chaincode/input/src/github.com/car-trade (from $GOPATH)
/opt/gopath/src/github.com/car-trade
"
at self._endorserClient.processProposal (/home/raj/Documents/verifyV2/fabric-samples/balance-transfer/typescript/node_modules/fabric-client/lib/Peer.js:140:36)
at Object.onReceiveStatus (/home/raj/Documents/verifyV2/fabric-samples/balance-transfer/typescript/node_modules/grpc/src/client_interceptors.js:1207:9)
at InterceptingListener._callNext (/home/raj/Documents/verifyV2/fabric-samples/balance-transfer/typescript/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/home/raj/Documents/verifyV2/fabric-samples/balance-transfer/typescript/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/home/raj/Documents/verifyV2/fabric-samples/balance-transfer/typescript/node_modules/grpc/src/client_interceptors.js:845:24)
status: 500,
payload: <Buffer >,
peer:
{ url: 'grpcs://localhost:7056',
name: 'peer2',
options:
{ 'grpc.max_receive_message_length': -1,
'grpc.max_send_message_length': -1,
'grpc.keepalive_time_ms': 120000,
'grpc.http2.min_time_between_pings_ms': 120000,
'grpc.keepalive_timeout_ms': 20000,
'grpc.http2.max_pings_without_data': 0,
'grpc.keepalive_permit_without_calls': 1,
'grpc.ssl_target_name_override': 'peer1.org1.example.com',
'grpc.default_authority': 'peer1.org1.example.com' } },
isProposalResponse: true }
我进入了对等容器,并查看github.com目录,该目录需要同时具有example_cc和我的自定义链代码的链代码。但是我都找不到。
我想知道示例代码和自定义代码都位于链代码所在的位置。