Core concepts
Understanding the protocol
Iris is a protocol that allows you to create a channel between two contracts. The protocol is implemented as a smart contract on the Ethereum blockchain.
The purpose of the Protocol is to bring an useful and an easy way to manage complex systems of interconnected smart contracts.
Currently the Ethereum network does not support a natively way to emit and listen to events on-chain but Iris protocol tries to resolve that
How does it work
Iris Protocol uses an architecture approach called broadcast method
where the a smart contract A.K.A. The Channel broadcast an event to a list of susbcribed Listeners (Smart contracts) through a network (Iris Smart Contract)
This Channel and listeners needs to be registered on the network.
Channels
A Channel Smart contract is the responsible of broadcasting the message. Each message does have the networkAddress
the eventIndex
and some data
if is necesary.
broadcast(networkAddress, myEventIndex, data);
The Network (Iris Smart contract) does receive the message, like an antena, and redistribute it to the registered listeners.
Network
The Iris protocol Smart contract Network is responsible to distribute messages across the channels and its listener.
This Neiwork allows to manage a channel and its listeners through our app. Check the implemetation on how to setup your channel.
Listeners
This are the contracts who receive the messages and react acordigly to the developed scrtipt. On the listener contract you can catch the message overriding
function onReceivedMessage(address sender, string memory eventIndex, bytes memory data) internal{};
where you can check the sender and eventIndex to do your logic. Also the data field is supported to send data through your channels.