Introduction
Mainly is a simple REST API for Solana. No JSON-RPC, no encoding puzzles, no Web3 expertise required.
What is Mainly?
Mainly is a middleware API that sits between your application and the Solana blockchain. You call plain REST endpoints and get back clean, predictable JSON — the same way you'd use Stripe or any other modern web API.
You do not need to know what a lamport is, how JSON-RPC batching works, what
base64+zstd encoding means, or why a blockhash expires. We handle all of that.
The problem
Talking to Solana directly means hand-writing JSON-RPC like this — and this is one of the simple calls:
curl -X POST https://your-rpc-provider.example/?api-key=KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "1",
"method": "getBalance",
"params": ["9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM", {"commitment": "confirmed"}]
}'{ "jsonrpc": "2.0", "id": "1", "result": { "context": { "slot": 341197053 }, "value": 1529000000 } }That 1529000000 is not SOL — it's lamports (billionths of SOL). Every real task
gets worse from here: token balances arrive as raw integer strings that need a
separate decimals lookup, account data comes base58- or base64-encoded, token
metadata requires a different API entirely, and "show me this wallet's tokens"
takes three to four chained calls across two token programs.
The same call on Mainly
curl https://api.sarg.am/v1/solana/wallets/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM/balance \
-H "Authorization: Bearer $MAINLY_API_KEY"{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"lamports": 1529000000,
"sol": 1.529
}What you get
- REST, not JSON-RPC.
GETandPOSTwith normal paths and status codes. - Human-readable amounts everywhere. Every value comes in both raw and decimal form. See Amounts & units.
- Composite endpoints. One call for things that normally take four — a wallet's full token list with names, logos, and USD prices; parsed transaction history in plain English; a send flow that handles blockhashes, priority fees, and confirmation for you.
- One pagination scheme.
cursor+limiton every list endpoint. See Pagination. - Consistent errors. Machine-readable error codes with human explanations. See Errors.
Scope
Today Mainly supports Solana (mainnet and devnet). The API is deliberately
chain-scoped — /v1/solana/... — so additional networks (Ethereum, Bitcoin,
Avalanche, and others) can ship under the same conventions later. See the
Roadmap.
Ready to make your first call? Head to the Quickstart.