Mailchain users can send messages to any Algorand account address. This section details how the Algorand implementation of the Message Flow is achieved.
Mailchain supports all the public Algorand networks
To send an encrypted message, a public key is required. Mailchain uses the public key associated with an account address to encrypt message data, and if specified by the envelope, the message contents too. This ensures the recipient is also the owner of the private key and only they can decrypt data. The public key finder returns the public key for a recipient public address.
Algorand transactions are used to send a message.
Transactions contain a
note field that stores the envelope. Bytes can be stored in the
note field and can be any data up to 1000 bytes. Data stored in a transaction must follow the Mailchain standard encoding format:
[protocol-prefix]+[mailchain-prefix]+[envelope]. This data will be encoded to Base64 when transmitted.
Transaction data prefix is not required for Algorand.
"mailchain" encoded as base64
Envelope encoded as hexadecimal
An example of a transaction
note field for a Mailchain message sent on Algorand is as follows:
To send a message the following Algorand transaction fields must be specified.
Paid by the sender to the FeeSink to prevent denial-of-service. The minimum fee on Algorand is currently 1000 microAlgos.
The first round for when the transaction is valid. If the transaction is sent prior to this round it will be rejected by the network.
The ending round for which the transaction is valid. After this round, the transaction will be rejected by the network.
The hash of the genesis block for the network for which the transaction is valid. See Algorand developer documentation for details of the genesis hash for MainNet, TestNet, and BetaNet.
The address of the account that sends the messages and pays the fee.
Added by the client, based on sender address in message.
The address of the account that receives the message.
Added by the client, based on recipient address in message.
Specifies the type of Algorand transaction. Mailchain uses a zero-value payment transaction by default.
The total amount to be sent in microAlgos.
Mailchain sets this to
Once the transaction fields have been populated, it must be signed using the sender private key. The signed transaction bytes can then be transmitted to the Algorand network via the Algorand network API endpoint using the
POST /v2/transactions method.
To read Mailchain messages for a specific address, transactions sent to that address need to be identified. The Algorand indexer natively supports an address index to identify all transactions sent to a specific address.
Rekeying an account enables an Algorand account holder to maintain a static public address while dynamically rotating the authoritative private spending keys (see https://developer.algorand.org/docs/features/accounts/rekey/ for more information).
If an account has been rekeyed, Mailchain will include the rekeyed account address in the reply-to field. Any replies to messages received from an authorised address for a rekeyed account will be sent to the initial rekeyed account.