This specification is designed to make it easier to notify users of any events on the part of TON smart contracts. I have prepared message structures and recommendations for various services. This specification will be useful for wallets, blockchain explorers and other services that display messages from the blockchain to the user.
Spec
It is supposed that the smart contract to notify the user, can send an internal message to the smart contract of the user's wallet. The message must be formed according to a specific structure (see TL-B sheme below).
comment and real_body are mandatory. We must tell the user in English text(utf-8 encoding) about an event in comment, and also have the ability to pass additional information to real_body, which can be read by a third-party service. If you don't have specific information for real_body you must specify rop in it, but you don't have to attach data.
These notifications may carry 0 or more TON coins with them.
If you are a developer of a wallet or any other service that displays TON
blockchain messages to users and decide to follow this specification, you must:
Identify the message as an incoming notification
Correctly read the message according to the TL-B sheme
Display data from comment to the user in utf-8
Display at least rop from real_body
If possible, read data from real_body
Additional information
Notification op code (notification#0x3f5476ca) calculated with:
The use of & 0x7fffffff conditioned by paragraph 5 "Internal messages"
of the "Smart contract guidelines" section of the documentation
Fighting spam
As you may have already guessed, these notifications can be used to send spam.
To avoid this, I offer a few recommendations for services/wallets:
Use a trusted registry of smart contracts that will not send spam.
For example you can check a smart contract by its hash of source code.
You can give the user the option of automatically grouping the notification
or adding the address/(smart contract by its source code hash) to a blacklist.
This specification is designed to make it easier to notify users of any events on the part of TON smart contracts. I have prepared message structures and recommendations for various services. This specification will be useful for wallets, blockchain explorers and other services that display messages from the blockchain to the user.
Spec
It is supposed that the smart contract to notify the user, can send an internal message to the smart contract of the user's wallet. The message must be formed according to a specific structure (see TL-B sheme below).
comment
andreal_body
are mandatory. We must tell the user in English text(utf-8 encoding) about an event incomment
, and also have the ability to pass additional information toreal_body
, which can be read by a third-party service. If you don't have specific information forreal_body
you must specifyrop
in it, but you don't have to attachdata
.rop
correspond to the purpose of op from the "Smart contract guidelines"These notifications may carry 0 or more TON coins with them.
If you are a developer of a wallet or any other service that displays TON
blockchain messages to users and decide to follow this specification, you must:
comment
to the user in utf-8rop
fromreal_body
data
fromreal_body
Additional information
Notification op code (
notification#0x3f5476ca
) calculated with:The use of
& 0x7fffffff
conditioned by paragraph 5 "Internal messages"of the "Smart contract guidelines" section of the documentation
Fighting spam
As you may have already guessed, these notifications can be used to send spam.
To avoid this, I offer a few recommendations for services/wallets:
Use a trusted registry of smart contracts that will not send spam.
For example you can check a smart contract by its hash of source code.
You can give the user the option of automatically grouping the notification
or adding the address/(smart contract by its source code hash) to a blacklist.