Mailchain
Search…
Algorand
Mailchain users can send messages to any Algorand account address. This section details how the Algorand implementation of the Message Flow is achieved.

Networks

Mailchain supports all the public Algorand networks
Network
Status
Mainnet
Full
BetaNet
Full
TestNet
Full

Public Key Finder

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.
The public key for an account address can be calculated from the public address by converting it from its Base32 encoded representation to Base58 and removing the 4-byte checksum.

Sender

Algorand transactions are used to send a message.

Envelope

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.
Field
Example
Notes
protocol-prefix
None
Transaction data prefix is not required for Algorand.
mailchain-identifier
bWFpbGNoYWlu
"mailchain" encoded as base64
envelope
AQpuKuI/nZUw6qvRDt+/aAUOqu7J72/CZMc+kPsbVrCTq1MB9JwTVJadZJLB4h07XEon6Yf9ubvaxTTHAltoFjyWipQzyuxFfP1I8Y5OZE4dUFsEheF2jN8DUfKwpQKEKILoySTH6a4VhWwq8R1T3/0SBiIEsORJjw
Envelope encoded as hexadecimal
An example of a transaction note field for a Mailchain message sent on Algorand is as follows:
1
bWFpbGNoYWluAQpuKuI/nZUw6qvRDt+/aAUOqu7J72/CZMc+kPsbVrCTq1MB9JwTVJadZJLB4h07XEon6Yf9ubvaxTTHAltoFjyWipQzyuxFfP1I8Y5OZE4dUFsEheF2jN8DUfKwpQKEKILoySTH6a4VhWwq8R1T3/0SBiIEsORJjw==
Copied!
The same transaction and data can be viewed here on Algoexplorer.

Transaction Fields

To send a message the following Algorand transaction fields must be specified.
Field
Codec
Type
Example
Notes
Fee
fee
uint64
1000
Paid by the sender to the FeeSink to prevent denial-of-service. The minimum fee on Algorand is currently 1000 microAlgos.
FirstValid
fv
uint64
6000000
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.
LastValid
lv
uint64
6001000
The ending round for which the transaction is valid. After this round, the transaction will be rejected by the network.
GenesisHash
gh
[32]byte
"mainnet-v1.0"
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.
Sender
snd
Address
(string)
G2GTKMEEEEZH5TFUDYZMWWGXZLO3Z7765CR52ZXBBNCCMNPDYM3ZII7CSI
The address of the account that sends the messages and pays the fee.
Added by the client, based on sender address in message.
Receiver
rcv
Address
(string)
UWH6MCLMZSD2UYWTJVKFKX6JMTX2TGXAOYPUBNHFFQFBBVJULXJXZJNPBU
The address of the account that receives the message.
Added by the client, based on recipient address in message.
TxType
type
string
"pay"
Specifies the type of Algorand transaction. Mailchain uses a zero-value payment transaction by default.
Note
note
[]byte
bWFpbGNoYWluAQpuKuI/nZUw6qvRDt+/aAUOqu7J72/CZMc+kPsbVrCTq1MB9JwTVJadZJLB4h07XEon6Yf9ubvaxTTHAltoFjyWipQzyuxFfP1I8Y5OZE4dUFsEheF2jN8DUfKwpQKEKILoySTH6a4VhWwq8R1T3/0SBiIEsORJjw==
Envelope data
Amount
amt
uint64
0
The total amount to be sent in microAlgos.
Mailchain sets this to 0 (zero).
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.

Receiver

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

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.
Last modified 4mo ago