Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial MTX Messaging layer proposal #71

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chrisdigity
Copy link
Collaborator

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 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.
@chrisdigity
Copy link
Collaborator Author

This Pull Request has been opened as a Draft and will not be made available for merge until appropriate discussion has taken place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant