Decentralized applications (DApps) are becoming more popular every day, with many smart contracts that process transactions deployed to various blockchain networks in need of a notification system to track activities on the blockchain.
Push notifications have obviously been around for a while: simply, they provide the process of receiving messages from a server that triggers a pop-up on a client application that can have different forms for web, mobile, and desktop platforms.
Before the Ethereum push notification service (EPNS), there was no real way to achieve push notification functionalities on smart contracts and DApps.
While some wallets like Metamask notify users of every transaction carried out on their accounts, smart contract notifications were not previously really possible. But, in this post, we’ll cover the following to learn how EPNS works in DApps, including:
- What is EPNS?
- EPNS features
- Push nodes and $PUSH tokens
- Why do we need Web3 push notifications?
- Decentralized platforms that benefit from EPNS
- How to integrate EPNS in your DApps
- How to download EPNS and opt-in to channels
What is EPNS?
EPNS is a decentralized notification protocol that seamlessly gives Ethereum wallet addresses (or users) access to receive notifications for on-chain or off-chain activities.
With EPNS DApps, smart contracts and backend applications can send notifications to users in a platform-agnostic manner.
EPNS notifications are possible because of the open communication network, also called push nodes, which are tied to wallet addresses enabling crypto wallets, DApp frontends, and other services to display notifications to users.
EPNS also has a token called $PUSH that enables EPNS users to get incentives based on direct or indirect actions.
User-centric and opt-in notifications
The EPNS protocol allows users to directly control what services they receive notifications from and imposes strict rules on the services, including spam protection for users.
Incentivized notifications for users
Services that want to send notifications to their subscribers have to stake DAI. Interest earned during this process is distributed in portions to subscribers who opted to receive notifications. EPNS incentivizes both senders and receivers with usage rewards.
The EPNS protocol also enables retrievable information of every notification that enables universal notifications successively. It delivers notifications to any crypto wallets, mobile apps, web browsers, apps, or other platforms that integrate the protocol.
Spam score and throttling
Channels incorporate a spam score that ranges from
0 means the channel has a good score and
1 means the channel is extremely unhealthy.
The protocol governance is intended to incentivize continued adoption of the EPNS protocol, which is achieved by providing incentives for all users involved.
Push nodes and $PUSH tokens
EPNS is a protocol that has its own nodes (PUSH nodes) governed by the $PUSH token. PUSH nodes listen to events in the EPNS protocol smart contracts and send the notifications that are triggered by the events from corresponding recipients.
What are $PUSH tokens?
$PUSH tokens are used for governance in the EPNS ecosystem. The EPNS protocol provides incentives for users based on specific actions on the EPNS protocol, including subscribing to channels directly and indirectly, and users are given these incentives for participating in the EPNS protocol.
When token incentives are given to a user in the protocol, the user can claim them anytime. These token incentives are generated using AAVE aDAI (AAVE Interest Bearing DAI). The aDAI then converts to $PUSH tokens on withdrawal.
A $PUSH token has a total supply of 100,000,000, and only 100,000,000 will ever be created. The value of a $PUSH token at the time of writing is worth $1.13 and has a circulating supply of 15,287,926 (approximately 15%) of the total $PUSH tokens.
Why do we need Web3 push notifications?
Push notifications are an integral feature in the Web2 ecosystem and became an important strategy for sending information to and retaining users. But, Web2 notifications are entirely created and prescribed by the applications themselves.
Users hardly have a choice about what kinds of notifications they wish to receive; they can either turn off an application notification or turn it on.
Decentralized notifications like EPNS, on the other hand, provide the Web3 ecosystem with the benefits of a robust and improved notification ecosystem without the centralized drawbacks of Web2 notifications.
To receive Web2 notifications, a user must install the app they wish to receive notifications from, or visit their website and accept their notification prompt.
With EPNS, a user can receive notifications from platforms, like Coindesk, without installing the app; all they do is opt into their channe, providing the user more power to decide what notifications they choose to receive.
Applications need better ways to communicate with users in real-time and event-initiated ways than platforms like Twitter, Discord, or email. Users also deserve an easier process of controlling what notifications they receive, and should benefit from Web3’s open-source nature.
Decentralized platforms that benefit from EPNS
Almost any application in the Web3 ecosystem can benefit from push notifications. Some of these types of DApps are:
- Decentralized finance (DeFi)
- Decentralized exchanges (DEXes)
- Ethereum Name Service (ENS)/consumer apps
- Non-fungible tokens (NFTs) and gaming
When using EPNS in DeFi, notifications can be useful for lending protocol users. With this, users can set up notifications to be informed when their staked coins will liquidate. Instead of manually checking regularly, they can now receive seamless notifications.
DEX users can set up notifications to inform them when their trades complete instead of constantly checking back. EPNS enables them to get seamlessly notified; for instance, users can create notifications for when gas prices are favorable to help them decide when to trade.
Apps like the Ethereum Name Service (ENS) can notify users when their subscriptions are about to expire, rather than users checking regularly to remind themselves of expiration dates.
NFTs and gaming
NFTs trading on marketplaces or goods within games can connect to EPNS to inform users when certain items go on sale or when auctions go live.
NFT artists can also receive notifications when a bid is made for their NFTs or topped as well as create notifications for their NFTs resale.
Parts of the EPNS protocol solution
The EPNS solution is made of four modules: services, channels, users, and subscribers.
Services are addresses of DApps, wallet owners, or any Web3 service that wants to send notifications while channels are services that activate themselves on the EPNS protocol and can create notifications.
Users are Web3 participants that want to receive notifications about a DApp, wallet, or smart contract, and subscribers are users that elect to receive notifications from any particular channel and can select particular channels that send out specific notifications.
How to integrate EPNS into your DApps
To integrate EPNS in your DApps, you must create an EPNS channel. You can do this on EPNS the DApp mainnet website or staging website. After visiting the website, follow these steps to create a channel.
First, you will be prompted to connect your crypto wallet (either Metamask, Ledger, or Portis since EPNS staging DApps only support the Kovan test network).
After connecting your wallet, click CREATE YOUR CHANNEL and upload the channel logo (the logo must have a dimension of 128px by 128px).
To activate the channel, you are required to stake DAI tokens to contribute to the interest-generating staking pool on AAVE.
50 DAI is the minimum stake fee and the more DAI that is staked, the more interest can be generated by a channel. Which, in turn, incentivizes subscribers (on staging, you receive 50 DAI for testing).
After staking the DAI, you can give your channel a name and description. Then click SETUP CHANNEL to activate it.
After creating a channel successfully you can integrate it into your DApp backend or frontend applications.
Integrating EPNS into a Node.js backend
To integrate EPNS on your backend, you must first install the EPNS backend production or staging SDK:
npm install @epnsproject/backend-sdk for mainnet or
npm install @epnsproject/backend-sdk-staging for staging.
Next, copy the private key of the address used for creating the EPNS channel; you can find the code in this GitHub gist:
Integrating EPNS into a React frontend
To integrate EPNS on your React frontend, you must install the EPNS frontend production or staging SDK with
npm install @epnsproject/backend-sdk for production or
npm install @epnsproject/backend-sdk-staging for testing or development.
You can find the following code in this GitHub gist:
Subscribing to EPNS channels on a frontend application
Users can also subscribe to EPNS channels from a frontend application using the following code:
How to download EPNS and opt-in to channels
You can also use EPNS by downloading the app on your phone from the Google Playstore or Apple Appstore.
You can also use EPNS desktop and web apps, or download the EPNS web extension on your web browser, then connect your wallet(s) and select different channels based on which notifications you’d like to receive.
Push notifications are still a popular app feature for users, but with EPNS, this integral feature for Web3 provides users more control over notification settings, the notifications they wish to receive, and receive incentives for participation in the EPNS protocol.
EPNS has improved the current Web2 push notification protocol and Web3 users will greatly benefit from this solution. I hope every Web3 user uses EPNS for seamless notifications.
LogRocket is like a DVR for web and mobile apps, recording everything that happens in your web app or site. Instead of guessing why problems happen, you can aggregate and report on key frontend performance metrics, replay user sessions along with application state, log network requests, and automatically surface all errors.
Modernize how you debug web and mobile apps — Start monitoring for free.