Peer Channels is a secure persistent messaging medium, allowing broadcast communication in a one-to-many manner between entities. It allows Mapi to broadcast a Merkle Proof to anyone involved with a payment.
Peer Channels End to End Process
The following steps provide an end to end process of the Peer Channels usage:
The sender sends payment to the receiver.
Once the receiver deems the payment to be valid (for example, ancestors is verified), they create a new Peer Channel.
Once the channel has been created, the receiver creates three API Tokens for the new channel, as follows:
Two read only tokens
One write only token.
The receiver broadcasts the transaction to mapi, with a callback url pointing to the new Peer Channel, and an auth token as the write only API token.
The receiver uses one of the read-only tokens to subscribe to the new Peer Channel for notifications.
The receiver sends the other read-only token, along with the Peer Channel information (peerchannel host name, peerchannel ID) back to the sender.
The sender uses this information to also subscribe to the Peer Channel for notifications.
-- -- -- TIME DELAY -- -- --
Once the block is mined, mAPI uses its callback URL and write-only API token to POST the Merkle proof for the block to the Peer Channel.
When the Peer Channel receives the proof, it notifies all subscribers of a new message (in this case, the sender and the receiver).
Both the sender and the receiver make a REST API call to the Peer Channel, with their write-only tokens, to receive the sent Merkle proof.
Both the sender and the receiver store the Merkle proof in their respective data stores.