- Node.js (v14.x or later)
- SQLite3
-
Clone the Repository
git clone <repository-url> cd <repository-directory>
-
Install Dependencies
yarn install
-
Initialize and Run the Indexer
Start the indexer to begin collecting data from the Sei blockchain:
node index.js
This script will:
- Create necessary tables in the SQLite database (
smart_contracts.db
). - Fetch contract information from the Sei blockchain.
- Store the contract and related information in the database.
- Create necessary tables in the SQLite database (
-
Run the Real-Time Indexer
To keep the database updated with real-time data, run:
node realtime_index.js
This script:
- Connects to the Sei blockchain WebSocket.
- Subscribes to relevant events (
store_code
,instantiate
). - Updates the database with new data as events occur.
-
Query the Database
To execute predefined queries and explore the collected data:
-
Run
query_db.js
for general queries:node query_db.js
-
Run
query_top5.js
to get the top 5 most deployed contracts:node query_top5.js
-
- Database: The SQLite database (
smart_contracts.db
) is created in the project root directory. - WebSocket URL: The WebSocket URL for Sei blockchain is set in
realtime_index.js
(RPC_WEBSOCKET_URL
). - Logging: Logs are stored in
real_time_indexer.log
anddata_collection.log
.
- WebSocket Connection Issues: Ensure a stable internet connection and verify the WebSocket URL.
- Database Access Errors: Check if the database file is correctly created and accessible. Ensure permissions are set correctly.
- Missing Dependencies: Run
yarn install
to ensure all required packages are installed.