通过composer-rest-server创建卡

时间:2018-02-28 14:58:09

标签: hyperledger-composer

我可以使用composer-rest-api添加参与者,并且可以通过其余的API钱包通过composer-rest-api上传卡片。是否可以通过composer-rest-api创建卡?

我查看了这个答案Hyperledger Composer Web application user authentication,它提到了如何使用javascript api创建卡片。我使用javascript代码创建参与者并发布它,当我运行它($ node filename.js)时,它工作正常。如何将其添加到其余API,我需要修改哪个文件,以便将其余服务器包含在创建卡中。

2 个答案:

答案 0 :(得分:0)

是的确定 - 您将使用/api/system/issueIdentity中的http://localhost:3000/api/system/issueIdentity操作 - 您可以选择将卡保存到文件中(没有凭据设置,即注册ID和密码)。然后,如果需要,您可以再次在REST中使用http://localhost:3000/api/wallet/import' - and specify the card file to import from a 'Browse' (explorer) button. Once you import it to the wallet in your REST client, you can set it as the default card too using setDefault`端点操作导入卡(如您所做)。然后在注册后使用它,并确实将其导出以供其他地方使用。使用curl的示例:

curl -X POST --header' Content-Type:application / json' --header'接受:application / json' -d' {\"参与者":" org.acme.org.user#orguser1",\"用户ID":" dave&# 34; \}' ' http://localhost:3000/api/system/issueIdentity'

其中orguser1是您在Composer中创建的参与者。希望这会有所帮助。

答案 1 :(得分:0)

我能够执行O' Mahony先生提供的curl命令。但是,我不知道如何处理我收到的回复(请参阅下文)。有没有人有javascript示例代码来处理响应?感谢。

PK | eLgDconnection.json {"名称":" hlfv1""类型":" hlfv1""&orderers #34 ;: [{" URL":" GRPC://本地主机:7050"}]," CA&#34 ;: {" URL" :" http://localhost:7054""名称":" ca.org1.example.com"}"对等体":[ {" requestURL":" GRPC://本地主机:7051"" eventURL":" GRPC://本地主机:7053"}] "信道":" composerchannel"" mspID":" Org1MSP""超时" 300} PK | EL / metadata.json {"用户名":" voter114""版本":1," enrollmentSecret":" JoKCZAJxTfic" " businessNetwork":"投票网络"} PK | eLgDconnection.jsonPK | EL /