Skip to content

An EVM event monitoring and indexing service.

License

Notifications You must be signed in to change notification settings

eseiker/Corvette

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Corvette

scouts for events you are looking for on networks compatible with Ethereum JSON-RPC API.

Corvette is an EVM event monitoring and indexing service, written for Deno TypeScript runtime for effortless deployments.

Prerequistes

To run Corvette, you must have Deno and Node.js with corepack enabled installed (for Prisma client generation, until Prisma supports Deno natively.)

Before you can run the components, you must apply the database migrations to your DB. Adjust the database provider in prisma/schema.prisma, copy the configuration from the example .env.example to .env, and configure DATABASE_URL accordingly. Only SQLite (for development only) and PostgreSQL has been tested at the moment.

After database configuration, run deno task prisma db push. Your database will be populated with required tables.

Running the application for development

A convenience script (app.ts) for running all the components (except for web at the moment) is provided, along with a deno task (deno task serve) that runs this script with required permissions. After applying the database migrations and configuring .env, start the components with deno task serve. The database will automatically be connected with the default configuration. The script will also launch an instance of an embedded AMQP broker (https://deno.land/x/lop/mod.ts) and a webhook receiver for testing (testWebhookReceiver.ts) on http://localhost:8888.

The web component can be started with deno task serve-web.

The components will be started using the configuration defined in .env file by default. The configuration may also be overrided by providing the environment variables in the command line (such as BLOCK_FINALITY=finalized deno task serve.)

Running components independently & for production

The components (observer.ts, emitter.ts, api.ts, web/main.ts) can be started independently, by calling them with deno run. Refer to Dockerfile for each components' minimum required permissions. Also, multiple instances of the same components sharing the same network, DB, and message queue may also be run simultaneously to achieve failsafe and/or load balancing.

Before running the components, you must generate the Prisma client. You must do this each time you change the prisma/schema.prisma file or Prisma version. Generate the client with deno task prisma generate. You must also prepare the database and configure the components accordingly.

You also need an AMQP 0-9-1 compliant message broker (such as RabbitMQ.) For testing, you may also use lop, which is run when running the application with deno task serve: deno run -A https://deno.land/x/lop/mod.ts.

To configure each of the components with different configurations, you may need multiple copies of the application directory, or you may also provide the configuration as environment variables.

You can run each components like the following: deno run -A observer.ts.

Building docker images and running with docker-compose

You may also run the application with Docker. A Dockerfile along with docker-compose.yml is provided for suggesting image building procedures and container composition. You may build the images with docker compose build. A VERSION environment variable can be specified to set the version metadata and the tag version for the images. The images will be built with the tag ghcr.io/planetarium/corvette-*.

Then, you may run the containers from the images with docker compose up. By default, an instance of PostgreSQL and RabbitMQ will be brought up along with the components, with the data in docker-compose-data directory.

You may also see and modify the composition of the containers in docker-compose.yml file. A prebuilt docker image of each of the versions and commits in the main branch will be available in the GitHub Container Registry:

To use these images with the provided docker-compose.yml file, remove the build sections of each of the containers and replace the tag with the published tags. Note that these containers are made to use PostgreSQL for the database.

About

An EVM event monitoring and indexing service.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.7%
  • Dockerfile 1.3%