Establishes connection with dYdX node and publishes dYdx blockchain data to Synternet Data Layer via NATS connection.
Building from source.
make build
Getting usage help.
./build/dydx-publisher --help
To enable the publishing features, you must set the following environment variables before starting the dydx
publisher. These variables configure the NATS connection and define the publishing settings:
-
NATS URL
NATS_URL=nats://dal-broker
-
NATS NKey
NATS_NKEY=SA..BC
-
NATS JWT
NATS_JWT=eyJ0e...aW
-
Publisher Prefix
PUB_PREFIX=my-org
-
Publisher Name
PUB_NAME=dydx
-
Application API Endpoint
APP_API=http://localhost:1317
-
gRPC API Endpoint
GRPC_API=localhost:9090
-
Tendermint API Endpoint
TENDERMINT_API=tcp://localhost:26657
Running executable with flags.
./build/dydx-publisher \
--nats-url nats://dal-broker \
--prefix my-org \
--nats-nkey SA..BC \
--nats-jwt eyJ0e...aW \
start \
--app-api http://localhost:1317 \
--grpc-api localhost:9090 \
--tendermint-api tcp://localhost:26657 \
--publisher-name dydx
Running executable with environment variables. Environment variables are automatically attempted to be loaded from .env
file.
Any flag can be used as environment variables by updating flag to be UPPERCASE
words separated by _
(e.g.: flag nats-nkey
== env var NATS_NKEY
).
./build/dydx-publisher start
// .env file content
NATS_URL=nats://dal-broker
PREFIX=my-org
NATS_NKEY=SA..BC
NATS_JWT=eyJ0e...aW
APP_API=http://localhost:1317
GRPC_API=localhost:9090
TENDERMINT_API=tcp://localhost:26657
PUBLISHER_NAME=dydx
Note: instead of user NATS_NKEY
and NATS_JWT
single value of NATS_ACC_NKEY
can be supplied. In Synternet Data Layer Developer Portal
this is called Access Token
. See here for more details.
- dYdX gRPC should be configured at 9090 port
- gRPC endpoint is HTTP/2, thus any proxies or load balancers should be configured appropriately
dYdX publisher sends telemetry data regularly on {prefix}.{name}.telemetry
subject. The contents of this message look something like this:
{"nonce":"207aa","status":{"blocks":1,"errors":0,"events":{"max_queue":40,"queue":1,"skipped":0,"total":7},"goroutines":39,"indexer":{"blocks_per_hour":1142,"errors":0,"ibc":{"cache_misses":9,"tokens":916},"pool":{"current_height":15040158,"sync_count":0}},"mempool.txs":8,"messages":{"bytes_in":0,"bytes_out":496916,"in":0,"out":17,"out_queue":0,"out_queue_cap":1000},"period":"3.000121219s","pools":0,"published":0,"txs":6,"unknown_events":0,"uptime":"110h51m42.00052816s"}}
You can configure the interval of these messages by setting TELEMETRY_PERIOD
environment variable(default is "3s"
).
- Build image.
docker build -f ./docker/Dockerfile -t dydx-publisher .
- Run container with passed environment variables. See entrypoint.sh for available env variables in container.
docker run -it --rm --env-file=.env dydx-publisher
Run container with passed environment variables.
docker run -it --rm --env-file=.env ghcr.io/synternet/dydx-publisher:latest
docker-compose.yml
file.
version: '3.8'
services:
dydx-publisher:
image: ghcr.io/synternet/dydx-publisher:latest
environment:
- NATS_URL=nats://dal-broker
- PREFIX=my-org
- NATS_NKEY=SA..BC
- NATS_JWT=eyJ0e...aW
- APP_API=http://localhost:1317
- GRPC_API=localhost:9090
- TENDERMINT_API=tcp://localhost:26657
- PUBLISHER_NAME=dydx
You can refer to the official documentation for instructions how to run a full node in Mainnet.
The minimum recommended specs for running a node is the following:
16-core, x86_64 architecture processor 64 GiB RAM 500 GiB of locally attached SSD storage
We welcome contributions from the community. Whether it's a bug report, a new feature, or a code fix, your input is valued and appreciated.
If you have any questions, ideas, or simply want to connect with us, we encourage you to reach out through any of the following channels:
- Discord: Join our vibrant community on Discord at https://discord.com/invite/Ze7Kswye8B. Engage in discussions, seek assistance, and collaborate with like-minded individuals.
- Telegram: Connect with us on Telegram at https://t.me/synternet. Stay updated with the latest news, announcements, and interact with our team members and community.
- Email: If you prefer email communication, feel free to reach out to us at devrel@synternet.com. We're here to address your inquiries, provide support, and explore collaboration opportunities.