Binance TypeScript SDK example: rest-private-ed25519.ts
Binance Auth REST private ed25519 example for the Siebly Binance SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.
What This Example Covers
- Binance authentication and request-signing example in TypeScript.
- Uses the Siebly Binance SDK package
binanceinstead of hand-written signing code. - Source path:
Binance/Auth/rest-private-ed25519.ts. - Example category: Auth.
- Imports SDK symbols including
MainClient. - Calls SDK methods such as
getAccountInfo().
How To Use This Example
- Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
- For private or order-management examples, keep credentials in environment variables or a secret manager. Use read-only keys where possible, and check the execution mode reference before any exchange write path can run.
- Open the repository source when you need the latest committed version: GitHub source file.
Example Path
Binance/Auth/rest-private-ed25519.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Binance/Auth/rest-private-ed25519.ts
Related SDK Docs
Example Source
import { MainClient } from 'binance';
// Received after creating a new API key with a self-generated RSA public key on binance
// The self-generated RSA private key, this is never directly given to binance, but used to generate a signature
// Note: this MUST include the "BEGIN PRIVATE KEY" header so the SDK understands this is RSA auth
const ed25519PrivateKey = `
-----BEGIN PRIVATE KEY-----
lkmlkm123lkms1s12s+lkmlkm123lkms1s12s
-----END PRIVATE KEY-----
`;
const ed25519APIKey = 'lkmlkm123lkms1s12slkmlkm123lkms1s12slkmlkm123lkms1s12s';
const client = new MainClient({
api_key: ed25519APIKey,
api_secret: ed25519PrivateKey,
beautifyResponses: true,
});
(async () => {
try {
console.log('private api call result: ', await client.getAccountInfo());
} catch (e) {
console.error('request failed: ', e);
}
})();