BSNDA / PCNGateway-Java-SDK

Inside the SDK, we provide PCN gateway API encapsulation which you can use to implement the transaction querying, transaction interface calling, generate public key and private key locally, register user certificate, generate certificate signature, encrypt and decrypt data, etc.
Apache License 2.0
37 stars 14 forks source link

userRegister 返回User registration failed #7

Open sxl53037072 opened 2 years ago

sxl53037072 commented 2 years ago

使用PCNGateway-Java-SDK 的FabricTest.userRegister 方法进行用户注册测试,使用的服务是测试网服务,发起注册请求就提示User registration failed,没有其他信息了,看不出是什么问题,调用getLedgerInfo获取账本信息是可以返回数据的,说明加密应该没问题,请教下这个错误需要怎么解决,以下是请求及响应结果

------发送数据格式-------------:{"body":{"encryptionValue":"USER01123456","name":"USER01","secret":"123456"},"header":{"appCode":"app00157227dcaee9f427699b0661069a304ad","headerString":"USER0001202110261121520144624app00157227dcaee9f427699b0661069a304ad","userCode":"USER0001202110261121520144624"},"mac":"MEUCIQC+vB55ucqzbylsCe4swxyuzXlJiU5edH3/cC8Dhm2eQAIgLDg388Z9DAkf9lj2eC940+kGf3yI+kuIST83DuSADcs="}

响应结果:{"header":{"code":-1,"msg":"User registration failed"},"mac":"MEUCIQDhRvFn/AK07dpgcQNjhXrHOONTDc70ay6CyH4qE3AO4AIgIzpVShBmKuwdNmlh9izcDJFf9axebE+tDAs36kb+9Ls=","body":null}

billjackson5 commented 2 years ago

您好,在BSN测试网中,基于Fabirc框架部署的智能合约不支持子用户注册功能,所以调用userRegister会报错。您可以直接调用reqChainCode接口进行数据上链和查询的功能调试。如果想要使用注册子用户功能,您需要在联盟链服务中发布服务,然后调用此接口。

sxl53037072 commented 2 years ago

@billjackson5 感谢回答,直接调用reqChainCode的话,ChainCode是怎么来的,用例子中的会提示没找到 以下是请求和响应结果 ------发送数据格式-------------:{"body":{"args":["{\"basekey\":\"123\",\"basevalue\":\"123\"}"],"chainCode":"cc_app0001202109171125562435760_01","encryptionValue":"aryc5irOv/8jJtjWDmCs9AVDq0U+3Ifycc_app0001202109171125562435760_01set{\"basekey\":\"123\",\"basevalue\":\"123\"}","funcName":"set","nonce":"aryc5irOv/8jJtjWDmCs9AVDq0U+3Ify"},"header":{"appCode":"app00157227dcaee9f427699b0661069a304ad","headerString":"USER0001202110261121520144624app00157227dcaee9f427699b0661069a304ad","userCode":"USER0001202110261121520144624"},"mac":"MEQCIEoY4p1SW6pBNtrASSTgNuQR0ber+AZVAWmAAbrUSVyAAiAVLz8lsfIxctDuUzDQWpXvUYgusyOpPewmycrtRnm40A=="} 响应结果:{"header":{"code":-1,"msg":"Transaction processing for endorser [peer1.ecdsartestnode.bsnbase.com:10001]: Chaincode status Code: (500) UNKNOWN. Description: make sure the chaincode cc_app0001202109171125562435760_01 has been successfully instantiated and try again: chaincode cc_app0001202109171125562435760_01 not found"},"mac":"MEQCIElT4Zs1mCkWHcqHm5HjbliC2vE9QphNOqhX4ipOSBJDAiA66PRbjBRA7bhf2Kp+iQF1krcxcE4utl9GXeiSiAzLQw==","body":null}

zhangqingsong commented 2 years ago

@sxl53037072 您好,ChainCode在创建的服务详情页面获取,具体位置如下图 1637632952

@billjackson5 感谢回答,直接调用reqChainCode的话,ChainCode是怎么来的,用例子中的会提示没找到 以下是请求和响应结果 ------发送数据格式-------------:{"body":{"args":["{"basekey":"123","basevalue":"123"}"],"chainCode":"cc_app0001202109171125562435760_01","encryptionValue":"aryc5irOv/8jJtjWDmCs9AVDq0U+3Ifycc_app0001202109171125562435760_01set{"basekey":"123","basevalue":"123"}","funcName":"set","nonce":"aryc5irOv/8jJtjWDmCs9AVDq0U+3Ify"},"header":{"appCode":"app00157227dcaee9f427699b0661069a304ad","headerString":"USER0001202110261121520144624app00157227dcaee9f427699b0661069a304ad","userCode":"USER0001202110261121520144624"},"mac":"MEQCIEoY4p1SW6pBNtrASSTgNuQR0ber+AZVAWmAAbrUSVyAAiAVLz8lsfIxctDuUzDQWpXvUYgusyOpPewmycrtRnm40A=="} 响应结果:{"header":{"code":-1,"msg":"Transaction processing for endorser [peer1.ecdsartestnode.bsnbase.com:10001]: Chaincode status Code: (500) UNKNOWN. Description: make sure the chaincode cc_app0001202109171125562435760_01 has been successfully instantiated and try again: chaincode cc_app0001202109171125562435760_01 not found"},"mac":"MEQCIElT4Zs1mCkWHcqHm5HjbliC2vE9QphNOqhX4ipOSBJDAiA66PRbjBRA7bhf2Kp+iQF1krcxcE4utl9GXeiSiAzLQw==","body":null}