At this point I was unable to find clear examples on how to use getTransient in Node.js. Maybe you can help me just with the right link.
Assume I have a client application in Node.js that submits something like:
const privatePayload = new Buffer(JSON.stringify({"Args":args})).toString('base64');
const result = await contract.createTransaction(func).setTransient({"privatePayload" : privatePayload}).submit();
In my Node.js chaincode I have something like this:
var MAP = ctx.stub.getTransient();
...
What I see, is that data comes in form of
{ privatePayload:
{ key: 'privatePayload'
value:
ByteBuffer {
buffer: <Buffer 0a c1 .... >,
offset: ...,
...
}
I access this buffer, decode it and see, that it contains not only my payload as a string, but also name of OrgMSP, CERTIFICATE, channel information etc all in one block. My payload is at the end.
Is there a ready to use API to just access my payload? What is the actual format of this buffer?
Try chaincodeStub.getTransient().get('key').toString('utf8')