A blockchain data indexing tool for CodeChain
The software dependencies required to install and run CodeChain-indexer are:
Download CodeChain-indexer code from the GitHub repository
git clone [email protected]:kodebox-io/codechain-indexer.git
cd codechain-indexer
Use yarn package manager to install packages
yarn install
- Get CodeChain ready with the CodeChain RPC server
- Get PostgreSQL database ready for indexing block data
Update ./create_user_and_db.sql and config/* files before creating database schema. If you want to create a production datatabase, please create config/production.json by copying config/dev.json
# Download postgresql with Homebrew
brew install postgresql
brew services start postgresql
# Create users and databases
psql postgres -f create_user_and_db.sql
# Create tables for production
NODE_ENV=production yarn migrate
# Create tables for development
yarn run migrate
# Download postgresql
sudo apt install postgresql postgresql-contrib
# Create users and databases
sudo -u postgres psql -f create_user_and_db.sql
# Create tables for production
NODE_ENV=production yarn migrate
# Create tables for development
yarn migrate
yarn run start
# You can change the host of CodeChain and DB host on the config/dev.json
If you run the Indexer with the environment ENABLE_CCC_CHANGES_CHECK
variable,
the Indexer checks to see if CCCChanges is well calculated.
If you want to receive an email when an error is found, please set the SENDGRID_API_KEY
and SENDGRID_TO
variables.
If you want to receive a slack notification, please set the SLACK_WEBHOOK
variable.
yarn build
NODE_ENV=production node ./build/index.js
# You can change the host of CodeChain and DB host on the config/production.json
# Create the test database
NODE_ENV=test yarn run migrate
# Start testing
yarn run test
NODE_ENV=dev yarn run start
# Swagger UI is running at "http://host:port/api-docs/"
yarn run reset