# Chainworks API

Welcome to the Chainworks API documentation. Build powerful DeFi applications with our unified WebSocket API.

---

## What is Chainworks?

Chainworks provides a **WebSocket-based DeFi API** that enables developers and institutions to easily access trading, token analysis, and other DeFi functionality across multiple blockchains.

---

## Supported Chains

| Chain | Identifier | Type | Native Token |
| --- | --- | --- | --- |
| Ethereum | `eth` | EVM | ETH |
| Base | `base` | EVM | ETH |
| BNB Chain | `bsc` | EVM | BNB |
| Solana | `sol` | SVM | SOL |

---

## Core Features

### Token Trading

Execute swaps across multiple DEXes with optimal routing. Get quotes, build transactions, and send them with MEV protection.

### Price Quotes

Real-time price quotes with slippage calculation, price impact analysis, and liquidity information.

### Token Reports

Comprehensive token analysis including:

- Liquidity depth
- Buy/sell taxes
- Transfer limits
- Holder restrictions
- Market data

### Multi-Chain Transfers

Build and send native currency and token transfers across all supported chains.

---

## Quick Example

```typescript
import { io } from "socket.io-client";

const socket = io(CHAINWORKS_API_URL, {
  transports: ["websocket"],
  auth: { token: CHAINWORKS_API_AUTH_TOKEN },
});

socket.on("connect", () => {
  console.log("Connected to Chainworks API");

  // Get a buy quote
  socket.emit("/evm/buy/quote", {
    chain: "eth",
    token: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
    swapMode: "ExactIn",
    amountIn: "1000000000000000000",
    wallet: "0xYourWallet",
  });
});

socket.on("/evm/buy/quote", (response) => {
  if (response.success) {
    console.log("Price:", response.result.price);
  }
});
```

---

## Next Steps

- **[Quick Start](/docs/quickstart)** — Set up your environment and make your first request
- **[Authentication](/docs/authentication)** — Learn how to connect with your credentials
- **[EVM Endpoints](/docs/evm)** — Explore Ethereum, Base, and BSC APIs
- **[SVM Endpoints](/docs/svm)** — Explore Solana APIs
- **[Playground](/playground)** — Test the API interactively

---

## Frequently Asked Questions

### What is Chainworks?

Chainworks is a unified WebSocket API for building DeFi applications. One integration gives you trading, quotes, wallet data, and token info across Solana, Ethereum, Base, and BNB Chain.

### Which blockchains does Chainworks support?

Solana is the primary supported chain. Ethereum, Base, and BNB Chain are supported in beta. All chains share the same WebSocket API surface so you can write one integration.

### How do I authenticate with the Chainworks API?

Authentication is token-based. You pass your API URL and auth token to the Socket.IO client on connect; see /docs/authentication for the exact handshake.

### What transport does the API use?

The Chainworks API is delivered over a single WebSocket connection using Socket.IO. You emit requests and listen for responses on the same event name — no REST calls and no polling.

### Can I try the API without writing code?

Yes. The /playground page is an interactive tester where you can pick an endpoint, fill in parameters, connect with your credentials, and inspect the live response.

### Where can I see the full machine-readable docs?

Every docs page has a .md twin (for example, /docs/quickstart.md), and /llms-full.txt contains all documentation concatenated for LLM ingestion. /llms.txt is a compact index.
