How to Generate an Ed25519 Key Pair to Send API Requests on Binance

2023-07-11 10:48

Binance now supports using Ed25519 keys to create signed API requests. All you need to do is generate an Ed25519 key pair and register the public key on Binance.

What are Ed25519 API keys?

Ed25519 API keys use asymmetric cryptography to authenticate your requests on Binance API. Like RSA API keys, Ed25519 keys are asymmetric. You can generate a key pair, share the public key with Binance, and use your private key to sign requests.

Why do we recommend using Ed25519 instead of other API key types?

The Ed25519 digital signature scheme provides high security comparable to 3072-bit RSA keys, while having much smaller signatures that are faster to compute:

API Key Type

Signature Size

Signature Operation Time

HMAC-SHA-256

64 bytes

0.00 ms

Ed25519

88 bytes

0.03 ms

RSA (2048-bit)

344 bytes

0.55 ms

RSA (4096-bit)

684 bytes

3.42 ms

Although HMAC-SHA256 has a smaller signature size and operates faster, Ed25519 keys generally perform better on Binance API. Therefore, we recommend switching to Ed25519 keys.

How to create an Ed25519 key pair?

1. Go to the official Asymmetric Keys Generator website to download and install the latest version of the generator.

Note: The “.CHECKSUM” file is used to verify the integrity of the generator package. Please download both files to the same directory. Click here for more information.

2. Launch the application and you can use it to:

  • Choose Key Type: Choose the type of key to be generated. You can choose Ed25519, RSA 2048 bits, or RSA 4096 bits. Please note that Ed25519 is chosen by default.
  • Generate Key Pairs: Create new Ed25519 private and public key pairs. You may also paste your existing Ed25519 private key to the text box, and the application will automatically generate an associated Ed25519 public key.
  • Copy/Save Key Pairs: Copy the keys or save the Ed25519 keys into Private_key.txt and Public_key.txt files. Please note that the file extension has defaulted to .txt, but you can customize it to other formats. Do not share your private keys with anyone.

How to register my Ed25519 key on Binance?

1. Log in to your Binance account and go to [Profile] - [API Management]. Click [Create API].

2. Choose [Self-generated] and click [Next].

3. Copy the Ed25519 public key generated from Asymmetric Keys Generator and paste it into the box to register.

4. Enter a name for your API key. Then click [Next] and complete 2FA.

How to send a signed API request?

To send a signed API request, you can follow the steps in the API documentation. Go to [SIGNED Endpoint Example for POST /api/v3/order - Ed25519 Keys] under the [SIGNED Endpoint security] section for more details.