This project, which is in progress, is an G/RPC listener that listens for token transactions on the Raydium Constant Product AMM on the Solana Blockchain. The ingestor listens for swap transactions and mints along with burns if enabled. It continuously listens for these events and computes price, volume, and holdings changes; constantly caching then streaming the data via Kafka. From there, the data is then served through a RESTful API to trading and analytical microservices. The token data processing is done in golang for speed, the client API is built using FastAPI, and the G/RPC listener is in pure python. The database used is TimescaleDB and Interservice communication is done via Redis Pub/Sub and Kafka. All microservices along with Redis, Redis Commander, Kafka-UI, and TimescaleDB are currently being deployed using Docker Compose. It is recommended to host TimescaleDB, Kafka, and Redis on a cloud provider such as AWS, GCP, or Azure in production. For lowest latency, it is recommended to host the services in the same region/data center.
- Redis :6379 Default
- Redis Commander :8080 Default
- Kafka :9092 Default
- Kafka-UI :8081 Default
- TimescaleDB :5432 Default
git clone https://github.com/Zaydo123/Solana-RPC-Listenercd Solana-RPC-ListenerIn each microservice directory, there should be a .env.example file. Copy the contents of the .env.example file and create a new .env file in the same directory. Fill in the values with your own.
docker-compose up --buildIn the microservice directory, run the following command to install the dependencies:
pip install -r requirements.txtIn the token-data-processor directory, run the following command to install the dependencies:
go mod tidy
go mod downloadthen you may build the binary using
go build -tags musl -o myapp cmd/token-processor/main.goproduction run command
gunicorn -k uvicorn.workers.UvicornWorker main:appdevelopment run command - configured with uvicorn
python main.py- Pyscopg2 not installing on MacOS
- Install Homebrew
- Install openssl -
brew install openssl - If Processor >= M1 Chip:
export LIBRARY_PATH=$LIBRARY_PATH:/opt/homebrew/opt/openssl/lib- Adds openssl to the library path
- Intel Macs:
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/- Adds openssl to the library path
pip install psycopg2
- Docker build failing on MacOS relating to confluent-kafka
- Instead of running barebones
go build, run the following command:go build -tags musl -o myapp cmd/token-processor/main.go- See more at confluentinc/confluent-kafka-go#805
- Instead of running barebones
- Events API / Logger is still in progress.
- Database automatically creates tables and columns on first run.
- Migration to TimescaleDB is in progress.
- The project is still in progress and is not yet complete.
- Trading services are not being shared in this repository.

