Skip to main content

Getting Started with ChainX Scanner API

ChainX Scanner is a comprehensive smart contract vulnerability scanner with AI-powered analysis, security scoring, and subscription management. This guide will help you get up and running in minutes.

Prerequisites

  • A valid email address for registration
  • API access to the ChainX Scanner endpoints
  • A Solidity smart contract file (.sol) to scan

Step 1: Register Your Account

Create a new ChainX account with email verification:


curl -X POST https://chainx-api-a154bfdeaf7a.herokuapp.com/api/register \
-H "Content-Type: application/json" \
-d '{
"email": "developer@example.com",
"password": "securePassword123",
"name": "John Developer"
}'

Expected Response:


{
"message": "User registered successfully. Please verify your email.",
"userId": "cluxyz123",
"verificationSent": true
}

Step 2: Verify Your Email

Check your inbox for the OTP and verify your email:


curl -X POST https://chainx-api-a154bfdeaf7a.herokuapp.com/api/verify-email \
-H "Content-Type: application/json" \
-d '{
"email": "developer@example.com",
"otp": "12345678"
}'

Step 3: Login to Your Account

Now you can log in with your credentials:


curl -X POST https://chainx-api-a154bfdeaf7a.herokuapp.com/api/login \
-H "Content-Type: application/json" \
-d '{
"email": "developer@example.com",
"password": "securePassword123"
}'

Step 4: Generate an API Key

Generate an API key to authenticate your scan requests:


curl -X POST https://chainx-api-a154bfdeaf7a.herokuapp.com/api/generate-api-key \
-H "Content-Type: application/json" \
-d '{
"userId": "cluxyz123",
"type": "PRODUCTION",
"name": "My Production Key"
}'

Expected Response:


{
"message": "API key generated successfully",
"apiKey": {
"id": "key_123",
"keyValue": "prod-chainx-abc123...",
"type": "PRODUCTION",
"expiresAt": "2027-01-31T00:00:00Z"
}
}

tip

Store your API key securely. Never share it or commit it to version control. Use environment variables to manage sensitive credentials.

Step 5: Scan Your First Smart Contract

Now you're ready to scan! Use your API key to authenticate:


curl -X POST https://chainx-api-a154bfdeaf7a.herokuapp.com/api/v1/scan \
-H "X-API-Key: prod-chainx-abc123..." \
-F "file=@/path/to/contract.sol"

Example Response:


{
"success": true,
"message": "File scanned successfully",
"scanId": "cluxyz123scan456",
"file": "/uploads/contract_123.sol",
"vulnerabilitiesCount": 3,
"securityScore": {
"score": 75,
"rating": "Good",
"summary": {
"total": 3,
"critical": 0,
"high": 2,
"medium": 1,
"low": 0
}
},
"bestPractices": {
"recommendations": [
"Use well-audited libraries like OpenZeppelin",
"Implement reentrancy guards for state-changing functions",
"Add comprehensive input validation"
]
}
}

Check Your Subscription Plan

Verify your current plan and quota limits:


curl -X GET "https://chainx-api-a154bfdeaf7a.herokuapp.com/api/v1/user-plan?userId=cluxyz123" \
-H "Content-Type: application/json"

What's Next?