xmtpd
(XMTP daemon) is an experimental version of XMTP node software. It is not the node software that currently forms the XMTP network.
After xmtpd
meets specific functional requirements, the plan is for it to become the node software that powers the XMTP network.
Some of these requirements include reaching functional parity with the current node software and reliably performing data replication without data loss.
To keep up with and provide feedback about xmtpd
development, see the Issues tab in this repo.
To install dependencies and build background services needed by the node, run:
dev/up
This starts the following background services in Docker:
-
A Postgres database that is used to store data needed to run the node
-
A Prometheus instance that enables you to view metrics and data about the node, such as resource usage and errors
-
A Grafana instance that enables you to monitor the health and performance of the node
To stop the background services running in Docker, run:
dev/down
To start the xmtpd
node, run:
dev/run
To run tests against the xmtpd
node, run:
dev/test
These tests provide a full suite of unit and integration tests for the xmtpd
repo to help ensure and maintain correctness of the code over time and to avoid regressions as the code evolves. You can explore the tests by taking a look at any files with the suffix _test.go
.
The xmtpd
node build provides two options for monitoring your node.
-
To access your local Prometheus instance to explore node metrics, run:
open http://localhost:9090
To learn how to query node data in Prometheus, see Metric Types in Prometheus and PromQL and The Anatomy of a PromQL Query.
-
To access your local Grafana instance to explore and build node dashboards, run:
open http://localhost:3000
To learn how to visualize node data in Grafana, see Prometheus Histograms with Grafana Heatmaps and How to visualize Prometheus histograms in Grafana.
Please follow the style guide.
Submit and land a PR to https://github.com/xmtp/proto. Then run:
dev/generate
Create a new migration by running:
dev/gen-migration {migration-name}
Fill in the migrations in the generated files. If you are unfamiliar with migrations, you may follow this guide. The database is PostgreSQL and the driver is PGX.
We use sqlc to generate the code for our DB queries. Modify the queries.sql
file, and then run:
dev/generate
If needed, you may use dev/psql
to test more complex SQL syntax. To determine the level of support in sqlc, there is a sqlc playground for experimenting with how the query syntax translates into Go code.