Skip to content

Node.js server for pulling blocks off the blockchain and passing on to GCP

License

Notifications You must be signed in to change notification settings

KingdomStudiosIO/blockchain-poller

Repository files navigation

Blockchain Polling Node

Credit

This app was originally created by Magg at Kingdom.Watch, and then donated to DefiKingdoms for further development

About

This script can be used for feeding interesting transactions from the blockchain to a PubSub topic. The idea is to then process the transactions with Cloud Functions and finally persisting the state in Firestore or other suitable state stores.

This provides flexibility and let the solution scale automatically.

Getting started

To get started with PubSub sign up for the free tier over at Google Cloud, and create a PubSub topic.

Edit config.json with the smart contract addresses you want to watch, as well as the PubSub topics to publish the transactions to.

Example config:

{
  "firstBlockToProcess": 19000000,
  "lastBlockToProcess": 19000010,
  "websocketEndpoint": "wss://ws.s0.t.hmny.io/",
  "pollInterval": 1000,
  "contracts": [
    {
      "address": "0xabD4741948374b1f5DD5Dd7599AC1f85A34cAcDD",
      "pubSubTopic": "projects/YOUR_PROJECT/topics/YOUR_TOPIC",
      "firstBlock": 16339595
    }
  ]
}

Provide credentials for PubSub through the GOOGLE_APPLICATION_CREDENTIALS environment variable as described here.

About

Node.js server for pulling blocks off the blockchain and passing on to GCP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published