The C++ SBE Sample Application is a reference implementation that demonstrates how to decode Binance API responses encoded using Simple Binary Encoding (SBE).
It reads an SBE-encoded payload from STDIN and outputs a JSON representation to STDOUT, making it useful for debugging, testing, and validating SBE responses returned by Binance APIs.
For source code, updates, and examples, see the binance-sbe-cpp-sample-app repository on GitHub.
Supported environments
- Linux
- macOS
- C++20 compatible compiler
This is a sample application intended for local execution and inspection.
It is not a production-ready SDK.
What this sample demonstrates
This application focuses on decoding SBE responses, not on sending requests itself.
It demonstrates how to:
- Decode SBE-encoded API responses
- Convert binary SBE payloads into human-readable JSON
- Work with different authentication schemes when requesting SBE responses
- Reuse generated SBE decoders in C++ projects
Typical use cases
- Inspecting and validating SBE responses
- Debugging integrations using SBE
- Learning how Binance SBE schemas are decoded in C++
- Building internal tooling around SBE-based APIs
- Verifying authentication and signing workflows with SBE output
Getting started
Clone the repository:
Code
Compile the sample application:
Code
The resulting binary (sbe-sample-app) reads from STDIN and writes decoded JSON to STDOUT.
Using the sample app
The application is typically used by piping API responses into it.
Example: decoding an SBE REST response
Code
Example: decoding an SBE WebSocket response
You can pipe WebSocket responses into the app using a helper script or tool that sends WebSocket requests and forwards the raw response:
Code
To run websocket_send.py, your Python environment must include the websocket-client package.
Authentication
When requesting SBE responses from authenticated endpoints, standard Binance authentication methods apply.
Examples in the repository demonstrate usage with:
HMAC-based authenticationRSA-based authenticationEd25519-based authentication
The sample app itself does not perform request signing—it only decodes SBE responses.
SBE decoders
The repository includes C++ decoder classes generated from Binance SBE schemas using Simple Binary Encoding (SBE).
These decoders can be reused directly in your own C++ projects or adapted for custom SBE pipelines. If needed, the decoders can be regenerated from the latest schema files by following the instructions in the repository.
Notes and best practices
- This project is intended as a reference and debugging tool
- Always validate decoded fields against the official API documentation
- Prefer SBE only when binary efficiency or latency is required
- For general-purpose integrations, REST or WebSocket APIs may be simpler to use
- Use testnet environments when experimenting with authenticated endpoints