The Rust SBE Sample Application is a reference implementation that demonstrates how to decode Binance API responses encoded using Simple Binary Encoding (SBE) in a Rust environment.
It reads an SBE-encoded payload from STDIN and outputs a human-readable YAML representation to STDOUT, making it useful for inspecting, debugging, and validating SBE responses returned by Binance APIs.
For source code, updates, and examples, see the binance-sbe-rust-sample-app repository on GitHub.
Supported environments
- Rust (toolchain defined in
rust-toolchain.toml) - Linux
- macOS
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-encoded API responses, not on sending or managing requests.
It demonstrates how to:
- Decode SBE responses in Rust
- Convert binary SBE payloads into human-readable YAML
- Pipe SBE responses from REST or WebSocket APIs into a Rust decoder
- Reuse generated SBE decoder modules in Rust projects
Typical use cases
- Inspecting and validating SBE responses
- Debugging integrations that use SBE
- Learning how Binance SBE schemas are decoded in Rust
- Building internal tooling around SBE-based APIs
- Verifying authentication and request signing workflows with SBE output
Getting started
Clone the repository:
Code
Build the sample application:
Code
The resulting binary is located at:
Code
Using the sample app
The application reads SBE-encoded data from STDIN and prints decoded YAML to STDOUT.
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 forwards raw WebSocket messages:
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 application itself does not perform signing—it only decodes SBE responses.
SBE decoders
The repository includes Rust decoder modules generated from Binance SBE schemas using Simple Binary Encoding (SBE).
These decoders can be reused directly in your own Rust projects. 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