Blockchain exporter for the CosmosSDK based Blockchain(ex gaia). This backend server can be applied to any cosmosSDK based blockchain to sync as mongoDB collections.
Prerequisites
set up mongoDB
build source
Just run exporter binary after building source.
git clone https://github.com/cosmos-gaminghub/explorer-backend.git
cd explorer-backend
cp .env.example .env
make all
./build/exporter
./build/cron
or apply service to mangae exporter process.
### exporter service
tee /etc/systemd/system/explorer-backend.service > /dev/null <<EOF
[Unit]
Description=exploder-backend
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root/explorer-backend
ExecStart=/root/explorer-backend/build/exporter
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable explorer-backend
systemctl start explorer-backend
### cron service
tee /etc/systemd/system/explorer-cron.service > /dev/null <<EOF
[Unit]
Description=exploder-cron
[Service]
Type=simple
User=root
Group=root
WorkingDirectory=/root/explorer-backend
ExecStart=/root/explorer-backend/build/cron
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable explorer-cron
systemctl start explorer-cron
docker run -p 27017:27017 --name dev-mongo mongo
./build/exporter
Env Variables | Description | Default |
---|---|---|
DB_ADDR | mongo server's address | 127.0.0.1 |
DB_DATABASE | database's name | test |
DB_USER | database's username | |
DB_PASSWORD | database's password | |
DB_POOL_LOMIT | database max connection num | 4096 |
ADDR_NODE_SERVER | node lcd URI | http://198.13.33.206:1317 |
CoinGecko Env Variables | Description | Default |
---|---|---|
COINGECKO_API_ENDPOINT | API endpoint | https://api.coingecko.com/api |
COINGECKO_API_VERSION | API version | v3 |
COINGECKO_CURRENCY | API currency | usd |
In the backend, exporter binary watches cosmosSDK based chain node(especially blocks and proposals) and insert synced data into mongoDB. Also cron binary updates coingecko price data every 20min.
ref: