Real-time Ethereum Notifications for Everyone for Free

Combining Google PubSub with Cloud Functions will allow ingesting the Ethereum blockchain to a subscription topic, sharing it among millions of people, and running custom logic in serverless functions.

You can get notified via email or Slack whenever new blocks are mined, some tokens are transferred to your address, or a new Crypto Kitty is born. The current pricing models of PubSub and Cloud Functions will make the scaling free in most cases.

Here is how it works:

Blockchain data is streamed to “Ethereum Topic” in “Ingestion Project” (a project in GCP is an abstraction for managing cloud resources). Only the ingestion is billed to this project. The topic is shared to everyone with read-only access.

Users can create push subscriptions for the topic in their own projects. These subscriptions can then be connected to cloud functions that implement custom logic, e.g. sending a message to a Slack channel, or making a trade. Users are billed only for PubSub subscriptions and Cloud Function invocations.

The first 10GB in PubSub are free. In Cloud Functions, 2 million invocations, 400,000 GB-seconds, 200,000 GHz-seconds of compute time and 5GB of Internet egress traffic per month are free. Many use cases (e.g. subscribing to token transfers, grouped by block and sending a notification — 3GB of data, 200k invocations per month) will fit into the free tier. For the cases not covered by the free tier, the costs will be minimal.

There are a few challenges with this architecture, e.g. handling chain reorganizations, and configuring PubSub push endpoints, which are solvable.

Also read: