mochimo
mochimo copied to clipboard
Initial MTX Messaging layer proposal
This commit proposes suggested validation logic for a messaging layer that would exist as an extension to the existing MTX logic available from v2.4.1 of the codebase. The messaging layer would allow a sender of a transaction to append a message (known in the code as a memo) to the last destination tag of an MTX, using any remaining space available in the dst[] field.
Messaging layer specification: To maintain transaction type conformity, a transaction identified as a MTX Memo transaction SHALL have a memo exist in the transaction. To distinguish a memo from the dst[] tags, a memo SHALL always begin and end with a zero (0) byte (null termination char). To avoid binary abuse of the messaging layer, a memo SHALL contain only printable characters, as per the default C locale, and any remaining dst[] array space AFTER the the end of a memo SHALL be zero filled. To offset the validation costs of longer messages, the fee incurred for a memo of a certain length shall be equal to the fees incurred by tags that would otherwise use such a length.
The fee formula: (messagefees) = (fee) * (1 + ((messagelength + 1) / sizeof(MDST)))
'1 + ...' ensures that a fee is always paid by messages that do not utilize the entire space (MDST) of a dst[] field. '... (messagelength + 1) ...' ensures the initial zero (0) byte, which utilizes dst[] tag space, is accounted for in fee calculation.
Notes... Currently the fee calculation does not include the required ending zero byte terminating character. This allows a message to include a network fee for the first 19 characters and a subsequent network fee for every 20 characters thereafter. Accounting for the ending zero byte will introduce further (and objectively) unecessary validation processes.
This Pull Request has been opened as a Draft and will not be made available for merge until appropriate discussion has taken place.