Blockchain Analyzer is a NestJS-based application for analyzing blockchain transactions and token transfers. It uses Prisma as ORM and supports PostgreSQL for storing data.
- Fetch and store blockchain transactions for a specific address.
- Fetch and store token transfers for a specific address or contract address.
- Analyze affiliated addresses based on transactions.
- Check token transfer relations between addresses.
Before you begin, ensure you have met the following requirements:
- Node.js (>= 14.x)
- PostgreSQL database
- Yarn or npm
- Clone the repository:
git clone https://github.com/yourusername/blockchain-analyzer.git
cd blockchain-analyzer
- Install dependencies:
yarn install
# or
npm install
- Set up your environment variables by creating a .env file in the root directory with the following content:
DATABASE_URL="postgresql://<username>:<password>@<host>:<port>/<database>?schema=public"
ETH_API_KEY="<your_etherscan_api_key>"
- Migrate your database:
npx prisma migrate dev --name init
- Generate Prisma client:
npx prisma generate
To start the application, run:
yarn start
# or
npm start
The application will be available at http://localhost:3000.
To open Prisma Studio:
npx prisma studio
To run script from scripts folder use
npx ts-node scripts/*script-name*.ts
Fetch and store all transactions for a specific address.
POST /blockchain/transactions/all-in-out/:address
Fetch and store all token transfers for a specific address.
GET /blockchain/token-transfers/from-address/list/:address
Fetch and store all token transfers for a specific contract address.
GET /blockchain/token-transfers/from-contract/list/:contractaddress
Fetch and store all token transfers for a specific token and address.
GET /blockchain/token-transfers/token-from-address/list/:tokenaddress/:address
Analyze and find affiliated addresses based on transactions.
GET /blockchain/analisys/affiliates/:address/:range
Check token transfer relations between addresses.
GET /blockchain/token-transfers/relations/:address/:target
Get the count of stored transactions.
GET /blockchain/analisys/transactions/count
Get the count of stored token transfers.
GET /blockchain/analisys/token-transfers/count
To start API in dev mode run:
npm run start:dev