A TronMoji is a pixel-based image represented by a hexadecimal string. This string is written to the TRX transaction memo field. Below are the technical details on how a TronMoji image is constructed and interpreted by code:
The color of each pixel is represented by a single hexadecimal digit (0-9, a-f).
The color values are mapped as follows:
The grid dimensions (number of pixels in X and Y directions) are assumed to be 16x16.
Example: A 16x16 grid would have 256 pixels, requiring a 256-character hexadecimal string, prepended with 18-character hexadecimal string of 'tronmoji:', totaling 274 hexadecimal characters (274/2, 137 bytes).
TronMojis potentially violate UTF8 encoding, and as such must be written into both the memo and raw_hex fields manually.
When using TronWeb to create a transaction with a memo (stored in transaction.raw_data.data), the transaction.raw_data_hex representation of the transaction will include some prepended bytes before the actual memo data. These bytes are Protobuf encoding metadata, and they follow Protocol Buffers (ProtoBuf) varint encoding rules.
transaction.raw_data.data:
74726f6e6d6f6a693a001110000001110001fff110011fff100feeeff11ffeeef01feddeeffeeddef1fedddddeedddddeffeddddddddddddeffe2dddddddddddeffe2dddddddddddef1fe2dddddddddef101fe2dddddddef10001fe2dddddef1000001fe2dddef100000001fe2def10000000001feef1000000000001ff10000000000000110000000
transaction.raw_data_hex (data part):
890174726f6e6d6f6a693a001110000001110001fff110011fff100feeeff11ffeeef01feddeeffeeddef1fedddddeedddddeffeddddddddddddeffe2dddddddddddeffe2dddddddddddef1fe2dddddddddef101fe2dddddddef10001fe2dddddef1000001fe2dddef100000001fe2def10000000001feef1000000000001ff10000000000000110000000