The project consists of several sub-projects:
Channel API
Contract Event Listener
Contract
Contract Deployer
Each of them has its own respective README, this README goal is to explain how the system works overall.
In order to the system to function properly it needs at least 2 channels, each channel must have:
Channel API
Contract Event Listener
- Deployed
ChannelNode
contract New Messages Observer
processorCallback Spreader
processorCallback Delivery
processor
The proper minimal setup is defined in docker-compose.system.yml
, it consists of:
localstack
- AWS services emulationganache
- Ethereum blockchain emulationchannel-api-callback-server
- WebSub callbacks emulation and test utilitydeployer-participant-(au|gb)
- deploysChannelNode
contractchannel-api-(au|gb)
- REST API forChannelNode
contractnew-messages-observer-(au|gb)
- WebSub new channel messages listenercallback-spreader-(au|gb)
- prepares WebSub notification delivery jobscallback-delivery-(au|gb)
- delivers WebSub notifications to callbackscontract-event-listener-(au|gb)
- redirectsChannelNode
events tonew-messages-observer
NOTE:
Compose files are generated using
Makefile
, they can't be used separately. The reason behind this is the > inability to use YAML anchors with nativedocker-compose
compose files merging.
- Deployers deploy two
ChannelNode
contracts,ChannelNodeAU
andChannelNodeGB
ChannelNodeAU
andChannelNodeGB
go through their pairing process.Channel API AU
andChannel API GB
services start including:New Messages Observer
Callback Spreader
Callback Delivery
Contract Event Listener
- User
AU
posts a message toChannel API AU
viaPOST /messages
withreceiver=GB
Channel API AU
sends message viaChannelNodeAU
ChannelNodeGB
firesMessageReceivedEvent
Contract Event Listener GB
picks that event, reformats it and sends toNew Messages Observer GB
New Message Observer GB
filters the event byreceiver==GB
and passes it toCallback Spreader GB
Callback Spreader GB
creates notification jobs for each topic subscriber and passes them toCallback Delivery GB
Callback Delivery GB
posts notifications to the subscriptions callbacks.
make run-system
make shell-<service-name>
whereservice-name
is any of:channel-api-au
channel-api-gb
contract-event-listener-au
contract-event-listener-gb
deployer-participant-au
deployer-participant-gb
system-tests
localstack
ganache-cli
make run-system
- Use
Channel API AU
onlocalhost:9090
- Use
Channel API GB
onlocalhost:9091
make run-system-test
make run-channel-api-au-test
make run-contract-event-listner-test
make run-channel-api-au
make shell-channel-api-au
make run-contract-event-listener
make shell-contract-event-listener
NOTE:
Every project service except third parties has
container
mode in which it will hang forever, it's useful for docker development. The way this mode set may differ, but it's always set through docker-compose servicecommand
option.