SolTrack is a lightweight, real-time web application built with Next.js for tracking Solana wallet balances and calculating daily, weekly, and monthly profit and loss (PnL) statistics.
- Real-Time Balance Tracking: Displays the current balance of any Solana wallet using WebSocket for live updates.
- PnL Calculations:
- Daily PnL
- Weekly PnL
- Monthly PnL
- Database Integration:
- Weekly and monthly start dates and balances are stored in a database.
- Real-Time Data Updates: The balance is automatically updated in real-time as Solana transactions occur via WebSocket connection to the Solana RPC.
To run this project, ensure you have the following installed:
- Node.js 16+
- npm (Node package manager)
- PostgreSQL
-
Clone the Repository:
git clone https://github.com/maseurodrigo/SolTrack.git cd SolTrack -
Install Dependencies:
npm install
-
Set Up Environment Variables:
Create a
.envfile in the project root and define the following variable:DATABASE_URL="postgresql://<user>:<password>@<host>:<port>/<database>" NEXT_PUBLIC_SOLANA_RPC_WS_URL="wss://mainnet.helius-rpc.com/?api-key=<your-api-key>" NEXT_PUBLIC_PASSPHRASE="super_secret_passphrase_123"
- Replace
<user>,<password>,<host>,<port>, and<database>with your PostgreSQL credentials. - Replace
<your-api-key>with your Solana RPC WebSocket API key. - Replace
"super_secret_passphrase_123"with your custom encryption passphrase.
- Replace
-
Initialize Prisma:
Run the following commands to set up Prisma:
npx prisma db push npx prisma generate
-
Run the Application:
npm run start
-
Access the Dashboard:
Open your browser and navigate to
http://localhost:8080.
To track a wallet, enter the wallet address in the input field on the dashboard and click "Track Wallet". The wallet's balance will be displayed and updated in real-time based on Solana transactions.
- Weekly PnL: Enable the "Show Weekly PnL" toggle to display weekly profit and loss.
- Monthly PnL: Enable the "Show Monthly PnL" toggle to display monthly profit and loss.
- RPC Mainnet URL: The Solana RPC endpoint is set to the mainnet by default.
- RPC WebSocket URL: The Solana RPC WebSocket endpoint is configurable through the
NEXT_PUBLIC_SOLANA_RPC_WS_URLenvironment variable. - Database Storage:
- Weekly and monthly start dates and balances are stored in a PostgreSQL database.
The database structure is managed using Prisma ORM with the following schema:
model UserData {
wallet String @id
weekStartDate DateTime @map("week_start_date")
weekStartBalance Float @map("week_start_balance") @db.Real
monthStartDate DateTime @map("month_start_date")
monthStartBalance Float @map("month_start_balance") @db.Real
}This project is licensed under the MIT License. See the LICENSE file for details.

