Crypto.com Chain Indexing Service (chain-indexing) is a service to index all publicly available data on Crypto.com chain and persist structured information into storage.
Right now it supports Postgres database and provides RESTful API as query interface.
Using Docker is the easiest way to build chain-indexing. The Docker image contains
/app/chain-indexing
Compiled chain-indexing binary
/app/migrate
Program to perform migration
docker build -o chain-indexing .
- Go compiler
make all
- Crypto.com Chain full node
- Postgres Database
A sample configuration is available under config/config.sample.toml
.
Copy it, update configuration based on your setup and rename it as config/config.toml
.
Note: Postgres database password is not available in config.toml
nor command option. You must provide it as environment variable DB_PASSWORD
on start.
You can have your Postgres setup locally or remotely.
WARNING: The docker files available under docker/
is intended only for development and testing purpose only. Never use them in production setup.
For a local test run. A docker-compose file with Postgres database and PgAdmin console is available via running:
docker-compose --file docker/docker-compose.development.yml up -d
This will start the following docker instances on your local network when you use default credentials:
Docker image | Port | Username | Password | Other Config | Mounted volume |
---|---|---|---|---|---|
Postgres | 5432 | postgres | postgres | Database Name = postgres; SSL = true | ./pgdata-dev |
PgAdmin | 8080 | pgadmin@localhost | pgadmin | N/A | N/A |
for DB_PASSWORD, never use common word such as "postgres" , "admin", "password", choose at least 16 characters including number, special character, capital letters even in testing environment. if you don't use strong password, pgmigrate will stop further processing
docker run -it \
--env DB_USERNAME=postgres \
--env DB_PASSWORD=your_postgresql_password \
--env DB_HOST=host.docker.internal \
--env DB_PORT=5432 \
--env DB_NAME=postgres \
--env DB_SCHEMA=public \
chain-indexing /app/migrate -- -verbose up
./pgmigrate.sh -- -verbose up
docker run \
-v `pwd`/config:/app/config --read-only \
-p 28857:28857 \
--env DB_PASSWORD=your_postgresql_password \
chain-indexing /app/chain-indexing
env DB_PASSWORD=your_postgresql_password ./chain-indexing
./test.sh [--install-dependency] [--no-db] [--watch]
Providing --install-dependency
will attempt to install test runner Ginkgo if it is not installed before.
./lint.sh
Please abide by the Code of Conduct in all interactions, and the contributing guidelines when submitting code.