nautechsystems/nautilus_trader · error · anyhow::Error
Binance Spot market data mode SBE requires Ed25519 API crede
Error message
Binance Spot market data mode SBE requires Ed25519 API credentials. Set the appropriate env vars for your environment, or provide api_key/api_secret in the data client config
What it means
The Binance Spot data client is configured with spot_market_data_mode = Sbe, whose market data streams are authenticated with Ed25519 credentials. On connect, the client checks ws_client.has_credentials() and aborts when none were resolved. Credentials come from the data client config (api_key/api_secret) or environment variables: BINANCE_API_KEY/BINANCE_API_SECRET for live, BINANCE_TESTNET_API_KEY/BINANCE_TESTNET_API_SECRET for spot testnet, BINANCE_DEMO_API_KEY/BINANCE_DEMO_API_SECRET for demo; the old *_ED25519_* variables are no longer supported.
Source
Thrown at crates/adapters/binance/src/spot/data.rs:1500
Ok(())
}
fn dispose(&mut self) -> anyhow::Result<()> {
log::debug!("Disposing {id}", id = self.client_id);
self.stop()
}
async fn connect(&mut self) -> anyhow::Result<()> {
if self.is_connected() {
return Ok(());
}
register_binance_custom_data();
if self.spot_market_data_mode == BinanceSpotMarketDataMode::Sbe
&& !self.ws_client.has_credentials()
{
anyhow::bail!(
"Binance Spot market data mode SBE requires Ed25519 API credentials. \
Set the appropriate env vars for your environment, \
or provide api_key/api_secret in the data client config"
);
}
// Reinitialize token in case of reconnection after disconnect
self.cancellation_token = CancellationToken::new();
Self::refresh_instrument_catalogue(
&self.http_client,
&self.config.instrument_provider,
self.config.us,
&self.instruments,
&self.status_cache,
&self.ws_client,
&self.data_sender,
self.clock,View on GitHub (pinned to a4b06ed870)
Solutions
- Create an Ed25519 API key on Binance and set the env vars for your environment (e.g. export BINANCE_API_KEY=... and export BINANCE_API_SECRET="$(cat binance_ed25519_private.pem)" for live)
- Or pass api_key/api_secret directly in the Binance Spot data client config
- If the removed *_ED25519_* vars are set, migrate them to the standard names for your environment
- If you do not need SBE, switch spot_market_data_mode to Json, which needs no credentials for public market data
Example fix
# before # config uses SBE mode but shell has no credentials export SPOT_MARKET_DATA_MODE=SBE # mode set, creds forgotten # after export BINANCE_API_KEY="your-ed25519-api-key" export BINANCE_API_SECRET="$(cat binance_ed25519_private.pem)"
Defensive patterns
Strategy: validation
Validate before calling
# Before building the client, confirm credentials for the environment exist
import os
mode_is_sbe = config.spot_market_data_mode == BinanceSpotMarketDataMode.SBE
has_creds = bool(os.getenv("BINANCE_API_KEY") and os.getenv("BINANCE_API_SECRET")) or (
config.api_key is not None and config.api_secret is not None
)
assert not mode_is_sbe or has_creds, "SBE mode requires Ed25519 credentials" Prevention
- Create an Ed25519 keypair on Binance and export BINANCE_API_KEY / BINANCE_API_SECRET (secret as PEM) for live, or the TESTNET/DEMO variants for those environments
- Do not rely on the removed *_ED25519_* variable names
- Add a startup smoke test that fails fast when SBE mode has no credentials
When it happens
Trigger: Config sets BinanceSpotMarketDataMode::Sbe while the WebSocket client resolved no api_key/api_secret: env vars unset and no credentials set on the data client config for the configured environment.
Common situations: Copying an SBE config to CI or a new machine without exporting secrets; generating an Ed25519 key on Binance but forgetting to export the env vars; still using the removed BINANCE_ED25519_API_KEY-style variables; using an HMAC key where the SBE stream requires an Ed25519 keypair (secret must be the Ed25519 PEM).
Related errors
- Binance Spot 24-hour ticker custom data requires JSON market
- Binance Spot kline subscriptions require JSON market-data mo
- {standard_key_var} not found in config or environment
- {standard_secret_var} not found in config or environment
- Symbol '{}' is not trading (status: {})
AI-assisted analysis of nautechsystems/nautilus_trader@a4b06ed870 (2026-08-16).
Data as JSON: /api/errors/5feb5b0016916659.
Report an issue: GitHub.