Ethereum Push Notification Service: Web3 Communication Layer
When you implement notifications in an app, you typically have signals to event against. User account attributes and settings can be used to determine who gets what type of notifications. In Web3 dApps, the user account is the wallet. While the wallet holder signs the connection to a dApp, there isn’t a notion of a notification layer native to to that authentication handshake; and outside of validating the existence of a specific currency or NFT in the wallet, there aren’t the same kinds of signals available.
Enter the Ethereum Push Notification Service (EPNS) protocol. In an interview with The New Stack, EPNS co-founder Richa Joshi explained that the lack of a built-in communication layer for Ethereum apps “meant leveraging substandard indirect communication such as Twitter, Discord, or — in best-case scenarios — having a mobile app that sends in-app notifications for things done via their platform.” The in-app notifications for a mobile app are still limited by what’s exposed at a layer outside the authenticated wallet handshake, and don’t address users who may not use a wallet app — or even a wallet that has a mobile app.
The EPNS dApp, which implements the EPNS protocol, went live on the Ethereum Mainnet on January 11. According to Joshi, “EPNS is live right now with different applications, to demonstrate to developers how to implement the protocol in many different ways. EPNS is live for consumer infrastructure like Ethereum Name Service, for DeFi utilities like liquidation and governance, and for manual notifications like media alerts. This combination of on-chain + off-chain and automatic + manual means developers have plenty of references to look at in order to build their own channels and notifications.”
Implementing EPNS with Your dApp
The EPNS dApp allows you to create a channel and send notifications to subscribers of that channel. Messages can be sent either on-chain, which today incurs the gas fees associated with any Ethereum transaction, or they can be sent off-chain subject to EIP-712, which is designed to provide human-readable context in messaging via off-chain message signing. A frontend SDK written in TypeScript and designed to work with Node.js v10.0.0 or higher allows for additional flexibility.
The frontend SDK performs three key functions at the moment:
- Fetching notifications from EPNS backend.
- Parsing fetched notifications.
- Rendering parsed notifications on mobile or in a browser
EPNS also includes a backend SDK written in TypeScript, which allows developers to construct the payload and send notifications based on individualized needs using custom logic — which provides additional flexibility beyond the EPNS dApp. With the relative newness of EPNS, I suspect many of the use cases for this backend customization have yet to be implemented.
Maximizing Signal without the Noise
Given the propensity spammers have to abuse every available messaging technology, I asked Joshi how EPNS is thinking about notification abuse.
“Every User and Channel in the dApp is tied to a unique Address,” he replied. “This ensures that every channel is unique and has its own set of users who are interested in a specific type of notification that’s emitted by that channel. Most importantly, notifications sent out by a specific channel will land in the inbox of only those users who are subscribed to that channel. For every other unsubscribed user, the notification will always be in the SPAM box.”
If there are bad actors within the notification ecosystem, Joshi highlighted the role smart contracts play in weeding them out, explaining, “As per the current architecture of EPNS Smart contract, we have an on-chain verification feature that allows adequate verification procedure for channels to enhance the trust and reliability for specific channels. However, while malicious actors can be present in any platform, we acknowledge that quite well and our contracts include the feature to Block Channels as well. If a channel doesn’t behave adequately, the channel can be blocked based on a completely on-chain and decentralized governance procedure. Once blocked, the same wallet address can never be used to create any channels again.”
As with many fundamentals we take for granted in application development, notifications are in their infancy in the Web3 world. EPNS is at the bleeding edge of providing a solution for dApp notification. You can get your implementation questions answered or help shape the future of the project by joining the EPNS Discord.