Previously, buyers and sellers on our marketplace had to keep the DApp open on their browser to know if someone had sent them a message or made an offer on their listing. We can’t expect people to keep Origin’s marketplace DApp open on a browser tab forever (though we know some of you keep hundreds of tabs open for months) or check back constantly to see if there is something that needs their attention. Without outbound notifications, a message from a buyer to a seller might go unread for days. An offer might be submitted to a seller without the seller being aware of it for weeks. This isn’t an acceptable user experience for people who want to do business with each other. There must be some way to notify buyers and sellers of important events. Currently, we are only notifying users of events that are directly related to offers, such as an offer being made, accepted, disputed, or finalized. Message notifications are coming soon.

We chose to offer browser push notifications because we did not want to force users who wanted notifications to store their email address or phone number in a database we control. While email and phone notifications may be offered in the future, they will always be opt-in, and we will always have the option of browser notifications. We are committed to preserving as much user privacy as we can. In general, we default to methods that give users the most control and protection over what information they share.

Here is how Origin notifications work behind-the-scenes:

It’s a little complicated…

We register a service worker with the user’s browser. This service worker listens for browser events that improve the user experience. The user will be asked for permission to display browser notifications. If they decline, the process ends here. If they approve: The service worker subscribes to the browser’s push service using the public key from a VAPID key pair generated by Origin. This creates a subscription object. The DApp adds the user’s ETH wallet address to the subscription object and sends it to the notifications server. The notifications server stores the subscription object in a PostgreSQL database. Origin’s event listener detects a blockchain transaction involving Origin’s smart contracts. The event listener sends a webhook request to the notifications server to enable information delivery about the blockchain transaction and any associated ETH addresses. The notifications server checks the PostgreSQL database for any subscription objects that contain the ETH addresses involved in the blockchain transaction. If there is a match, the notifications server signs a message with the private key from Origin’s VAPID key pair and sends this message to the service worker registered to the matching user’s browser. This signature proves that the sender of the message is the same as the creator of the subscription object. The service worker displays a notification in the user’s browser. The user clicks on the browser notification and the DApp is either opened in a new tab or focused in a tab it where is already open.

To dig into the code, check out the GitHub issue and pull request from our star engineer, Micah.

Our work with notifications is not done and we are especially excited about mobile developments under progress. We are going to iterate our DApp frequently, adding new features and improving the user experience along the way. Our engineers are also hard at work at readying a developer platform that our partners and others can build on. Look for more exciting updates in Q4 and Q1. We want to thank all of our supporters and users, and we invite any curious newcomers to join us on this journey.

Check out our DApp today and be one of the early buyers or sellers on the platform.

Learn more about Origin: