问题
I am currently using Developer Environment for Hyperledger Fabrics. I tried using GET to retrieve block info and it does give me a response. However, in the response, there's one component called payload, and it's in a unreadable format. Is there a way to make it readable/decrypt it? For instance, in bluemix, when you do init of party "a" and party "b", the payload shows inita100b100.
Firstly, I did this transaction/REST request
{
"jsonrpc": "2.0",
"method": "invoke",
"params": {
"type": 1,
"chaincodeID":{
"name":"mycc"
},
"ctorMsg": {
"function":"invoke",
"args":["a", "b", "100"]
}
},
"id": 3
}
Then I did this query request
GET/localhost:5000/transactions/c6b0c82d-27f9-4c2c-8305-34b413d95057
and got back this as REST response
{
"type": 2,
"chaincodeID": "EgRteWNj",
"payload": "Ch8IARIGEgRteWNjGhMKBmludm9rZRIBYRIBYhIDMTAw",
"uuid": "c6b0c82d-27f9-4c2c-8305-34b413d95057",
"timestamp": {
"seconds": 1469643763,
"nanos": 524731069
}
}
So if there's anyway to decrypt/change Ch8IARIGEgRteWNjGhMKBmludm9rZRIBYRIBYhIDMTAw
to showing A transferred 100 to b
or something similar, at least being readable for less-technical users?
回答1:
The payload is just encoded, you can use this to decode it (the encoding is base64). There is also this function in javascript to decode it.
If you had security/privacy enabled, the payload would be encrypted too, so you would need the Certificate to decrypt the payload and then you could decode it.
来源:https://stackoverflow.com/questions/38617428/decrypting-the-payload-in-hyperledger