Skip to content

Sambhram1/solana-dusting-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solana Dusting/Poisoning Detection API

An API that identifies and classifies dusting and address poisoning transactions on Solana. Built to be easily integrated into wallets, explorers, and other Solana-based services.

Features

  • TypeScript Express API for handling requests
  • Python ML model for advanced transaction classification
  • Low false positive rate detection
  • RESTful endpoints for easy integration

Project Structure

solana-dusting-poisoning/
├── api/                # TypeScript Express API
│   ├── src/            # Source code
│   │   ├── index.ts    # API entry point
│   │   └── routes/     # API routes
│   └── package.json    # Node.js dependencies
│
└── model/              # Python ML Model
    ├── app.py          # FastAPI app
    ├── model.py        # ML model implementation
    ├── utils.py        # Feature extraction and utilities
    └── requirements.txt # Python dependencies

Getting Started

Prerequisites

  • Node.js (v16+)
  • Python (v3.8+)
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/solana-dusting-poisoning.git
    cd solana-dusting-poisoning
    
  2. Install API dependencies

    cd api
    npm install
    
  3. Install model dependencies

    cd ../model
    pip install -r requirements.txt
    

Running the Services

  1. Start the Python ML model (in one terminal)

    cd model
    python -m uvicorn app:app --host 0.0.0.0 --port 8000
    
  2. Start the TypeScript API (in another terminal)

    cd api
    npx ts-node src/index.ts
    

The API will be running at http://localhost:3000.

API Usage

Detect Dusting/Poisoning Transactions

Endpoint: POST /detect

Request Body:

{
  "transactions": [
    {
      "lamports": 203928,
      "signers": ["address1"],
      "recent_blockhash": "abc123",
      "slot": 123456,
      "fee": 5000,
      "num_instructions": 2,
      "num_accounts": 3,
      "num_pre_token_balances": 1,
      "num_post_token_balances": 1,
      "num_inner_instructions": 0
    }
  ]
}

Response:

{
  "results": [
    {
      "is_dust_or_poison": false,
      "confidence": 0.12,
      "tx_index": 0
    }
  ]
}

Health Check

Endpoint: GET /health

Response:

{
  "status": "ok"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published