xmtpd

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2024 License: MIT

README

xmtpd

Test Build

⚠️ Experimental: This software is in early development. Expect frequent changes and unresolved issues.

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.

Prerequisites

Note that a dependency of this repo will not compile with version of go newer than 1.22.

Install and build dependencies

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

To stop the background services running in Docker, run:

dev/down

Start the node

To start the xmtpd node, run:

dev/run

Test the node

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.

Monitor the node

To enable metrics you need to start the node with --metrics.enable. By default, we expose Prometheus metrics on port 8008.

curl http://localhost:8008

Contributing

Please follow the style guide.

Modifying the protobuf schema

Submit and land a PR to https://github.com/xmtp/proto. Then run:

dev/generate

Or wait for the nightly automation to finish.

Modifying the database schema

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.

Modifying database queries

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.

Directories

Path Synopsis
cmd
cli command
replication command
pkg
api
db
proto/identity/api/v1
Package apiv1 is a reverse proxy.
Package apiv1 is a reverse proxy.
proto/message_api/v1
Package message_apiv1 is a reverse proxy.
Package message_apiv1 is a reverse proxy.
proto/mls/api/v1
Package apiv1 is a reverse proxy.
Package apiv1 is a reverse proxy.
proto/xmtpv4/message_api
Package message_api is a reverse proxy.
Package message_api is a reverse proxy.
proto/xmtpv4/payer_api
Package payer_api is a reverse proxy.
Package payer_api is a reverse proxy.
tracing
Package tracing enables [Datadog APM tracing](https://docs.datadoghq.com/tracing/) capabilities, focusing specifically on [Error Tracking](https://docs.datadoghq.com/tracing/error_tracking/)
Package tracing enables [Datadog APM tracing](https://docs.datadoghq.com/tracing/) capabilities, focusing specifically on [Error Tracking](https://docs.datadoghq.com/tracing/error_tracking/)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL