A Real-Time Notification System for ICON

Recently, we pushed out a big update to the notification system for MetrICX. Previously, I-Score and deposit notifications could take up to 5 minutes to trigger. With the new system, the notification lag has been reduced to just 1-2 seconds. This drastic increase in performance was made possible thanks to a new notification system developed by RHIZOME team member Andrew Burns. In this post, Andrew answers a few important questions regarding the new notification system.

Can you give a 3-5 sentence overview of what this new notification platform is?

The platform uses a publish-subscribe architecture to allow the user (app or system) to subscribe to any event that occurs on the chain, and be notified immediately when it happens. In the case of MetrICX we are using Push notifications to let users know when they receive a deposit or receive rewards. The platform is evolving; it’s exciting! We are innovating as we go and are open to suggestions.

Why is this new notification system a positive development for the ICON ecosystem? What will developers and users be able to do with it that is currently not possible or easy?

We found that in principle it is not “hard” to make API calls to get a balance or make a transaction on the blockchain; the ICON Devs have done a really good job of documenting how to interact with the blockchain using their API. What we found quite challenging is “waiting” for some specific event to happen such as a deposit or smart contract activity (like betting in ICONbet). Essentially you end up polling (calling the API every few seconds) to see if the desired event has happened. This approach is not a sustainable solution to have in place across all applications in the ICON ecosystem. Imagine hundreds of applications doing a similar approach across the entire scope of the ICON ecosystem. What we envisage is to have a service that allows ICON developers who need real-time notification to be able to subscribe easily to any event that happens on the ICON.

What kind of notification system was MetrICX using before, and how does the new system improve on it?

Before we were using a very rudimentary type of approach for MetrICX, by simply polling the ICON API for changes in the balance and I-Score of a registered user every few minutes. But we quickly realised that this was not scalable, if we doubled our user base then the lag between the deposit and the push notification would also double, who wants to wait 10 minutes to realise they have received a deposit. Instead of checking constantly for balance changes, it now simply subscribes to a “Deposit” event, and sends the push-notification immediately if the block contains a transaction activity from a registered address.

What are your future plans to make this service more accessible to ICONists? Will a service be built on top of it, will developers have to deploy the code themselves, etc?

We want to make it easy for anyone to subscribe to an event using a smart contract (SCORE). By providing a callback url we are then able to send a notification to that endpoint everytime the registered event happens on the chain. Once we have this built, we will look at building this into an administration portal to help manage and create new subscriptions. As always, this is an on going process and we will pivot as needed.

In summary, this new notification system will allow any ICON developer or user to subscribe to any on-chain activity through an easy to use API. Stay tuned for more updates about the platform in the coming weeks.