Backends
Per-network data sources that power on-chain reads.
A backend is a per-network data source — the thing LaserEyes reads balances,
UTXOs, fees, and transactions from. Backends come from
@lasereyes/client and are supplied per network in your config.
Built-in backends
| Backend | Import | Notes |
|---|---|---|
| mempool.space | @lasereyes/client/backends/mempool | Base BTC reads, no API key. |
| Sandshrew | @lasereyes/client/backends/sandshrew | Broad coverage; takes an apiKey. |
| Maestro | @lasereyes/client/backends/maestro | Broad coverage; takes an apiKey. |
Each is a factory that resolves against a network:
import { createLaserEyesConfig } from '@omnisat/lasereyes-core'
import { MAINNET, TESTNET } from '@lasereyes/client'
import { mempool } from '@lasereyes/client/backends/mempool'
const config = createLaserEyesConfig({
chains: [MAINNET, TESTNET],
connectors: [/* … */],
backends: {
mainnet: mempool(),
testnet: mempool(),
},
})Combining backends
Compose a primary with a fallback for one network using combineBackends — the
first to satisfy a capability wins:
import { combineBackends } from '@lasereyes/client'
import { sandshrew } from '@lasereyes/client/backends/sandshrew'
import { mempool } from '@lasereyes/client/backends/mempool'
const config = createLaserEyesConfig({
chains: [MAINNET],
connectors: [/* … */],
backends: {
// sandshrew primary, mempool fallback for base BTC reads
mainnet: combineBackends(sandshrew({ apiKey: '…' }), mempool()),
},
})Custom backends
You can implement your own backend with the primitives in
@lasereyes/client/backends (createChainBackend, combineBackends).
See Client › Backends for building one.
The native wallet RPC shortcut: when the connected wallet exposes an operation directly (e.g. balance), that path is tried before the backend.