使用 API POST 链码(智能合约)到 hyperledger-fabric 的问题
Problems to POST chaincode (smart contract) to hyperledger-fabric using API
我已经在 Bluemix 上部署了 hyperledger-fabric 服务并从那里获得了凭证,其中一行如下所示:
{"enrollId":"user_type1_0","enrollSecret":"XXXXX","group":"group1","affiliation":"0001","username":"user_type1_0","secret":"XXXXX"}
我 post "registrar" REST 端点的以下内容:
Secret: { "enrollId": "user_type1_0", "enrollSecret": "xxxxx" }
我收到这样的回复:
{ "OK": "Login successful for user 'user_type1_0'." }
然后我尝试使用将以下内容发布到链代码 REST 端点来注册一些链代码:
QuerySpec {
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/ibm-blockchain/learn-chaincode/finished"
},
"ctorMsg": {
"function": "init",
"args": [
"hi there"
]
},
"secureContext": "user_type1_0_xxxxx"
},
"id": 1 }
我收到这样的回复:
{ "jsonrpc": "2.0", "error": {
"code": -32000,
"message": "Registration missing",
"data": "User not logged in. Use the '/registrar' endpoint to obtain a security token." }, "id": 1 }
有什么想法吗?
Fabric 希望您提供 EnrolmentID 作为安全上下文,但您正在尝试使用 "ID+Pass"。
您可以尝试 运行 您的部署命令使用另一个 SecurityContext 值吗?
QuerySpec { "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeID": { "path": "https://github.com/ibm-blockchain/learn-chaincode/finished" }, "ctorMsg": { "function": "init", "args": [ "hi there" ] }, "secureContext": "user_type1_0" }, "id": 1 }
我已经在 Bluemix 上部署了 hyperledger-fabric 服务并从那里获得了凭证,其中一行如下所示:
{"enrollId":"user_type1_0","enrollSecret":"XXXXX","group":"group1","affiliation":"0001","username":"user_type1_0","secret":"XXXXX"}
我 post "registrar" REST 端点的以下内容:
Secret: { "enrollId": "user_type1_0", "enrollSecret": "xxxxx" }
我收到这样的回复:
{ "OK": "Login successful for user 'user_type1_0'." }
然后我尝试使用将以下内容发布到链代码 REST 端点来注册一些链代码:
QuerySpec { "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeID": { "path": "https://github.com/ibm-blockchain/learn-chaincode/finished" }, "ctorMsg": { "function": "init", "args": [ "hi there" ] }, "secureContext": "user_type1_0_xxxxx" }, "id": 1 }
我收到这样的回复:
{ "jsonrpc": "2.0", "error": { "code": -32000, "message": "Registration missing", "data": "User not logged in. Use the '/registrar' endpoint to obtain a security token." }, "id": 1 }
有什么想法吗?
Fabric 希望您提供 EnrolmentID 作为安全上下文,但您正在尝试使用 "ID+Pass"。
您可以尝试 运行 您的部署命令使用另一个 SecurityContext 值吗?
QuerySpec { "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1, "chaincodeID": { "path": "https://github.com/ibm-blockchain/learn-chaincode/finished" }, "ctorMsg": { "function": "init", "args": [ "hi there" ] }, "secureContext": "user_type1_0" }, "id": 1 }