Fabric-sdk-jAVA #fabric-sdk-java


Hi All,

How to decode the data from blocklistener? is it possible to decode the output from blockEvent.getBlock() ?
Attaching the file for the reference

Mark Lewis

The BlockEvent itself has lots of helpful accessor methods to help you navigate to useful data within the block, so you should probably prefer those if they do what you need. getBlock() returns the Block protobuf message, which is defined in the Fabric protocol buffer definitions:


The overall structure is quite complex, containing nested serialized protobuf messages. The Block object itself is a Java stub built from the protobuf definitions and contains methods to access data, so there is no need to "decode" it -- that has already been done. The protocol buffer documentation describes how the stubs packaged in fabric-sdk-java relate to the protocol buffer definitions and the API they provide: