wormhole-explorer/blockchain-watcher
Julian Merlo 0b62615dcc Change error foulder name 2023-11-24 12:18:18 -03:00
..
.github [Blockchain Watcher] Feature-813/fix-coverage-report (#815) 2023-11-23 13:23:27 -03:00
config add solana env var 2023-11-23 12:06:45 -03:00
docs [Blockchain Watcher] Apply missing formatting for log message published (#791) 2023-11-12 19:34:53 -03:00
src Change error foulder name 2023-11-24 12:18:18 -03:00
test Fix repository names 2023-11-24 10:44:11 -03:00
.dockerignore Blockchain Watcher: ethereum -> sns implementation (#790) 2023-11-10 09:28:37 -03:00
.gitignore Blockchain Watcher: ethereum -> sns implementation (#790) 2023-11-10 09:28:37 -03:00
.prettierrc.json Blockchain watcher: adding domain and infra layers (#786) 2023-11-07 15:25:06 -03:00
Dockerfile Blockchain Watcher: ethereum -> sns implementation (#790) 2023-11-10 09:28:37 -03:00
README.md updating readme 2023-11-21 15:39:31 -03:00
TODO.md adding some new abstract types for processor redesign 2023-10-25 10:58:09 -04:00
jest.config.js [Blockchain Watcher] Feature-813/fix-coverage-report (#815) 2023-11-23 13:23:27 -03:00
package-lock.json updating version 2023-11-22 17:30:09 -03:00
package.json [Blockchain Watcher] Feature-813/fix-coverage-report (#815) 2023-11-23 13:23:27 -03:00
tsconfig.json folder rename 2023-10-25 10:03:12 -04:00

README.md

Explorer Blockchain Watcher

The purpose of this process is to watch all Wormhole connected blockchains for events in Wormhole ecosystem contracts, and then produce database records for these events, and other important associated data.

Installation

run npm ci in the root of the project run npm dev in the root of the project

Deployment

This process is meant to be deployed as a docker container. The dockerfile is located in the root of the project. As of today, we have a one to one relationship from job to pod. So we statically define jobs as a config map that each pod then loads. See ../deploy/blockchain-watcher/workers for an example of how deployment works.

Configuration

Configuration is loaded from files in config directory. There is a default file, and then a file for each environment. The environment is set by the NODE_ENV environment variable. If NODE_ENV is not set, the default file is used.

Some values may be overriden by using environment variables. See config/custom-environment-variables.json for a list of these variables.

$ NODE_ENV=staging LOG_LEVEL=debug npm run dev

When running locally, you need to configure one or more jobs. By default, jobs are read from metadata-repo/jobs/jobs.json.

Example:

{ "jobs": [
  {
    "id": "poll-log-message-published-ethereum",
    "chain": "ethereum",
    "source": {
      "action": "PollEvmLogs",
      "config": {
        "fromBlock": "10012499",
        "blockBatchSize": 100,
        "commitment": "latest",
        "interval": 15000,
        "addresses": ["0x706abc4E45D419950511e474C7B9Ed348A4a716c"],
        "chain": "ethereum",
        "topics": []
      }
    },
    "handlers": [
      {
        "action": "HandleEvmLogs",
        "target": "sns",
        "mapper": "evmLogMessagePublishedMapper",
        "config": {
          "abi": "event LogMessagePublished(address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel)",
          "filter": {
            "addresses": ["0x706abc4E45D419950511e474C7B9Ed348A4a716c"],
            "topics": ["0x6eb224fb001ed210e379b335e35efe88672a8ce935d981a6896b27ffdf52a3b2"]
          }
        }
      }
    ]
  }
]}

Usage & Modification

Currently, jobs are read and loaded based on a JSON file. Each job has a source, and one or more handlers. Each handler has an action, a mapper and a target. For example, you can choose to use PollEvmLogs as an action and HandleEvmLogs as a handler. Fot this handler you need to set a mapper like evmLogMessagePublishedMapper. The target can be sns, or a fake one if dryRun is enabled.