{"record":{"id":"5feb5b0016916659","repo":"nautechsystems/nautilus_trader","slug":"binance-spot-market-data-mode-sbe-requires-ed25519","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/data.rs","lineNumber":1500,"sourceCode":"        Ok(())\n    }\n\n    fn dispose(&mut self) -> anyhow::Result<()> {\n        log::debug!(\"Disposing {id}\", id = self.client_id);\n        self.stop()\n    }\n\n    async fn connect(&mut self) -> anyhow::Result<()> {\n        if self.is_connected() {\n            return Ok(());\n        }\n\n        register_binance_custom_data();\n\n        if self.spot_market_data_mode == BinanceSpotMarketDataMode::Sbe\n            && !self.ws_client.has_credentials()\n        {\n            anyhow::bail!(\n                \"Binance Spot market data mode SBE requires Ed25519 API credentials. \\\n                 Set the appropriate env vars for your environment, \\\n                 or provide api_key/api_secret in the data client config\"\n            );\n        }\n\n        // Reinitialize token in case of reconnection after disconnect\n        self.cancellation_token = CancellationToken::new();\n\n        Self::refresh_instrument_catalogue(\n            &self.http_client,\n            &self.config.instrument_provider,\n            self.config.us,\n            &self.instruments,\n            &self.status_cache,\n            &self.ws_client,\n            &self.data_sender,\n            self.clock,","sourceCodeStart":1482,"sourceCodeEnd":1518,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/spot/data.rs#L1482-L1518","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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"],"exampleFix":"# before\n# config uses SBE mode but shell has no credentials\nexport SPOT_MARKET_DATA_MODE=SBE  # mode set, creds forgotten\n\n# after\nexport BINANCE_API_KEY=\"your-ed25519-api-key\"\nexport BINANCE_API_SECRET=\"$(cat binance_ed25519_private.pem)\"","handlingStrategy":"validation","validationCode":"# Before building the client, confirm credentials for the environment exist\nimport os\n\nmode_is_sbe = config.spot_market_data_mode == BinanceSpotMarketDataMode.SBE\nhas_creds = bool(os.getenv(\"BINANCE_API_KEY\") and os.getenv(\"BINANCE_API_SECRET\")) or (\n    config.api_key is not None and config.api_secret is not None\n)\nassert not mode_is_sbe or has_creds, \"SBE mode requires Ed25519 credentials\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["binance","spot","sbe","credentials","ed25519","configuration"],"backgroundTag":"missing-api-credentials","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}