Running Locally
Running the Transaction Stream Service Locally
When building a custom processor, you might find it helpful to develop against a local development stack. The Transaction Stream Service is a complicated, multi-component system. To assist with local development, we offer a Python script that wraps a Docker compose file to set up the entire system.
This script sets up the following:
Single node testnet with the indexer GRPC stream enabled.
A Redis instance.
Transaction Stream Service, including the following components:
cache-worker: Pulls transactions from the node and stores them in Redis.
file-store: Fetches transactions from Redis and stores them in a filesystem.
data-service: Serves transactions via a GRPC stream to downstream clients. It pulls from either the cache or the file store depending on the age of the transaction.
Shared volumes and networking to hook it all up.
You can learn more about the Transaction Stream Service architecture here and the Docker compose file here.
Prerequisites
In order to use the local development script you must have the following installed:
Python 3.8+: Installation Guide.
Poetry: Installation Guide.
Docker: Installation Guide.
Docker Compose v2: This should be installed by default with modern Docker installations, verify with this command:
docker-compose version --shortgrpcurl: Installation Guide
OpenSSL
Preparation
Clone the endless-core repo:
# HTTPS
git clone https://github.com/endless-labs/endless.git
# SSH
git clone https://github.com/endless-labs/endless.gitNavigate to the testsuite directory:
cd endless-core
cd testsuiteInstall the Python dependencies:
poetry installRunning the script
Starting the service
poetry run python indexer_grpc_local.py startYou will know this succeeded if the command exits, and you see the following:
Attempting to stream from indexer grpc for 10s
Stream finished successfullyStopping the service
poetry run python indexer_grpc_local.py stopWiping the data
When you start, stop, and start the service again, it will re-use the same localnet data. If you wish to wipe the locnet and start from scratch you can run the following command:
poetry run python indexer_grpc_local.py wipeUsing the local service
You can connect to the local Transaction Stream Service, e.g. from a custom processor, using the following configuration values:
indexer_grpc_data_service_address: 127.0.0.1:50052
auth_token: dummy_tokenYou can connect to the node at the following address:
http://127.0.0.1:8080/v1Debugging
Usage on ARM systems
If you have a machine with an ARM processor, e.g. an M1/M2 Mac, the script should detect that and set the appropriate environment variables to ensure that the correct images will be used. If you have issues with this, try setting the following environment variable:
export DOCKER_DEFAULT_PLATFORM=linux/amd64Additionally, make sure the following settings are correct in Docker Desktop:
Enabled: Preferences > General > Use Virtualization framework
Enabled: Preferences > General > Use Docker Compose V2
Disabled: Features in development -> Use Rosetta for x86/amd64 emulation on Apple Silicon
This script has not been tested on Linux ARM systems.
Redis fails to start
Try setting the following environment variable before running the script:
export REDIS_IMAGE_REPO=arm64v8/redisCache worker is crash-looping or Redis latest version update failed. in log
Wipe the data:
poetry run python indexer_grpc_local.py wipeThis means historical data will be lost.
Last updated