Establishes connection with Substrate blockchain based node and publishes blockchain data to Synternet via NATS connection.
This repository uses GSRPC ensuring compatibility with all substrate based chains. Tested blockchain: Polkadot, peaq.
Polkadot streams available in testnet Synternet portal
peaq specific custom PeaqStorage
events ItemAdded
, ItemRead
, ItemUpdated
are decoded. Available in testnet Synternet portal.
Building from source
make build
Running executable
./dist/substrate-publisher start --rpc-url wss://rpc.polkadot.io --nats-nkey SA..BC
Environment variables can be passed to docker container. Flags can be passed as executable arguments.
Environment variable | Flag | Description |
---|---|---|
RPC_URL | rpc-url | Substrate node RPC url, e.g.: wss://rpc.polkadot.io |
NATS_URLS | nats-urls | NATS connection URLs to Synternet brokers, e.g.: nats://e.f.g.h . URL to broker. Default: testnet. |
NATS_NKEY | nats-nkey | NATS user NKEY, e.g.: SU..SI (58 chars). See here. |
NATS_JWT | nats-jwt | NATS user JWT, e.g.: eyJ... . See here. |
STREAM_PREFIX | stream-prefix | Stream prefix, usually your organisation, e.g.: synternet prefix results in synternet.substrate.<tx,log-even,header,...> stream subjects. Stream prefix should be same as registered wallet alias. |
STREAM_PUBLISHER_NAME | stream-publisher-name | (optional) Stream publisher infix, e.g.: foo infix results in prefix.foo.<tx,log-even,header,...> stream subjects. Stream publisher infix should be same as registered publisher alias. Default: substrate . |
See Data Layer Quick Start to learn more.
Synternet uses NATS authentication model. NATS has an accounts level with users belonging to those accounts. To publish user level NKEY and JWT have to be used, which are generated from account.
- Acquire account level NKEY (in Synternet a.k.a.
access token
). See here. - Generate user level
NATS_NKEY
,NATS_JWT
from account level NKEY. See command below:
# Outputs user level NKEY and JWT individually by providing account level NKEY
go run github.com/synternet/data-layer-sdk/cmd/gen-user@latest
- Pass generated
NATS_NKEY
andNATS_JWT
.
- Build image.
docker build -f ./build/Dockerfile -t substrate-publisher .
- Run container with passed environment variables.
docker run -it --rm --env-file=.env substrate-publisher
Run container with passed environment variables.
docker run -it --rm --env-file=.env ghcr.io/synternet/substrate-publisher:latest
docker-compose.yml
file.
version: '3.8'
services:
substrate-publisher:
image: ghcr.io/synternet/substrate-publisher:latest
environment:
- RPC_URL=wss://rpc.polkadot.io
- NATS_NKEY=secret-access-token
- STREAM_PREFIX=your-org
- STREAM_PUBLISHER_INFIX=substrate-based-chain
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/jqZur5S3KZ. 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.