Introduction
Overview
The Hydra API is the gRPC surface of Hydra App — a multi-asset off-chain node spanning Bitcoin (Lightning) and the account-model chains (Lithium on EVM and Tron). Build applications that can:
- Trade across chains — atomic swaps between Bitcoin, Ethereum, Arbitrum, Tron and the tokens on them
- Manage payment channels — open, deposit, withdraw, close, and batch those operations
- Send instant payments — invoices, keysend, and hashlock (HTLC) payments
- Lease liquidity — inbound capacity from the liquidity service, without funding it yourself
- Settle on-chain when there is no channel — on-chain HTLCs as an alternative swap rail
- Follow everything live — streams for balances, channels, payments, markets and swaps
Key Features
Multi-Asset Support
- Bitcoin — native BTC over Lightning
- EVM — the native coin and ERC-20 tokens, over Lithium channels
- Tron — native TRX and TRC-20 tokens
- Cross-chain atomic swaps between any of them
Channel Operations
- Channel lifecycle management, on every protocol
- Payment routing and invoicing
- Direct channel payments
- Hashlock payments (HTLC)
Decentralized Exchange
- Limit and market orders
- Liquidity provision
- Real-time orderbook streaming
- Automated market making
Simple Swaps
- Automatic channel setup
- One-click cross-chain swaps
- Configurable slippage tolerance
- Automatic fund withdrawal
Supported Networks
Mainnet — real funds; access is invite-gated at launch:
| Network | Protocol | Network ID | Native asset id |
|---|---|---|---|
| Bitcoin | 1 (BITCOIN) | f9beb4d9 | 0x0000…0000 (32 bytes) |
| Ethereum | 2 (EVM) | 1 | 0x0000000000000000000000000000000000000000 |
| Arbitrum One | 2 (EVM) | 42161 | 0x0000000000000000000000000000000000000000 |
Staging — testnet funds only:
| Network | Protocol | Network ID | Native asset id |
|---|---|---|---|
| Bitcoin Signet | 1 (BITCOIN) | 0a03cf40 | 0x0000…0000 (32 bytes) |
| Ethereum Sepolia | 2 (EVM) | 11155111 | 0x0000000000000000000000000000000000000000 |
| Arbitrum Sepolia | 2 (EVM) | 421614 | 0x0000000000000000000000000000000000000000 |
| Tron Shasta | 3 (TRON) | 2494104990 | T9yD14Nj9j7xAB4dbGeiX9h8unkKHxuWwb |
Tron is not part of the mainnet launch. The full identifier table, including every other accepted network name, is in the Setup Guide.
API Architecture
Two transports, one port
Hydra App serves gRPC over HTTP/2 and JSON-RPC 2.0 over HTTP on the same settings.server_port, and routes by content type. Browser clients can use gRPC-Web against the same endpoint.
- gRPC — typed, binary, and the only transport that carries the server-streaming subscriptions. Generate stubs from the
.protobundle. - JSON-RPC — no codegen, ideal for shell scripts and languages without good gRPC tooling. No streaming over plain HTTP POST.
Important: unlike a hosted REST API, you run the server. Hydra App is a node on your own machine or infrastructure; there is no shared endpoint to call, and no API key — see the Setup Guide.
⚠️ The server is unauthenticated — bind it to localhostEvery RPC, including signing, sending and force-closing, is reachable by anyone who can open a TCP connection to the port. Keep it on
127.0.0.1, or behind your own authenticating proxy. Never expose it to a public interface.
Service Organization
| Service | Namespace | Purpose |
|---|---|---|
| AppService | app | Network info, identity key, preimage lookup, invites / referral, archive retention |
| WalletService | wallet | Deposit addresses, balances, transaction history, rescan |
| AssetService | asset | The registry of assets the node tracks; runtime token registration |
| BlockchainService | blockchain | Read-only chain queries, fee estimates, raw broadcast, token allowances and permit terms |
| ClientService | client | Build, sign and broadcast on-chain transactions; allowances and token permits |
| SignerService | signer | Sign and verify messages and transactions with the wallet's keys |
| NodeService | node | Channel and payment management, peers, watchtowers, funding allowances |
| WatchOnlyNodeService | watchOnlyNode | Read-only node identity, channels and payment history |
| OrderbookService | orderbook | Trading, market data, fee tiers, and real-time events |
| SwapService | swap | Swap estimation, execution, and progress tracking |
| LiquidityService | liquidity | Service-backed channel liquidity (the Lease API) |
| PreimageService | preimage | Settle a revealed preimage — channel legs and on-chain HTLC legs |
| HtlcService | htlc | On-chain HTLC operations (lock / claim / refund / verify / watch) |
| EventService | event | Client, node and HTLC event streams |
| PricingService | pricing | Asset fiat price feeds |
The full service list (with RPC counts and per-service doc links) is in Getting Started → Available services.
Real-Time Event Streams
Hydra provides WebSocket-like streaming for real-time updates:
| Stream | Service | Purpose |
|---|---|---|
| SubscribeClientEvents | event | Chain sync, blocks, wallet transactions, balance updates |
| SubscribeNodeEvents | event | Channel and payment lifecycle, peers, watchtowers |
| SubscribeHtlcEvents | event | On-chain HTLC lifecycle (locked / claimed / refunded) |
| SubscribeMarketEvents | orderbook | Public market data, orderbook, trades, candlesticks |
| SubscribeDexEvents | orderbook | Your own trading activity, orders, balances, swaps |
| SubscribeSimpleSwaps | swap | Simple swap progress with automatic channel setup |
| SubscribeArchivePruneEvents | app | Archive-retention job lifecycle |
Every event type is catalogued in Events & Subscriptions; how to consume them safely is the Streaming guide.
API Principles
- Resource-oriented. Operations act on channels, orders, payments and assets, named by id.
- Estimate, then execute. Every operation that costs money has an
Estimate*twin taking the same request. Call it first — it is also where a simple swap tells you why it cannot proceed. - Amounts are human-readable. Every
DecimalStringis in whole asset units — never satoshis, never wei. See Amounts and precision. - Stateless requests. Each call carries everything it needs; the node holds no per-client session.
⚠️ Most write RPCs are not idempotentA retry after a timeout can send a second transaction, open a second channel, or place a second order.
Get*andEstimate*are always safe; writes need either a verification read first or, for order placement, theclient_order_ididempotency token. The rules per RPC are in Errors → Idempotency & Retry Safety.
Rate limits
Hydra App applies no rate limiting — it is your own node, and the only budget that binds is its own capacity and that of the chain endpoints it talks to. A bot that polls where it could subscribe is spending your provider quota, not the API's.
The upstream services the node talks to (orderbook, liquidity service, price oracle) have their own limits, which the node manages on your behalf.
Versioning
The Protocol Buffer package is hydra_app, unversioned: the schema a build speaks is the schema in its bundled rpc.discover output, which is authoritative for that build. Track changes in the Changelog.
Next Steps
- Getting Started - Make your first API calls
- Common Patterns - Learn about data structures
- Wallet API - Check balances and transactions