Connect to Binance
Learn how to connect Gainium to Binance.
TL;DR
Step-by-step guide to connecting Binance to Gainium via API keys. Binance requires ED25519 API keys for Spot trading—generate a key pair with OpenSSL, upload the public key to Binance, then enter the API key and private key in Gainium.
Gainium uses APIs to connect to your exchange and make trades. In this article, we will show you how to generate an API key in Binance and connect your account to Gainium.
Important Update (February 2026): Binance now requires ED25519 API keys for Spot trading. Users with existing Spot Binance connections must update their API keys to ED25519 format by February 20, 2026. This does not require creating a new exchange account in Gainium — you can simply update your existing keys.
Step 1 - Open Binance Dashboard#
Switch to the new browser tab, log in, or create a new account on https://binance.com/.
Step 2 – Find "API Management" in Binance#
Move your cursor over the profile icon in the upper right corner and choose "API Management."

Step 3 - Create API (Select Self-generated)#
Click "Create API" and select "Self-generated" as the API type. This is required for ED25519 keys.

Step 4 – Generate Your ED25519 Key Pair#
Before proceeding in Binance, you need to generate an ED25519 key pair on your computer.
For macOS and Linux users#
Open your terminal and run the following commands:
openssl genpkey -algorithm ed25519 -out private_key.pem
openssl pkey -in private_key.pem -pubout -out public_key.pem
This will create two files:
private_key.pem- Your private key (keep this safe and secret!)public_key.pem- Your public key (you'll paste this into Binance)
For Windows users#
- Download and install OpenSSL for Windows
- Open Command Prompt or PowerShell
- Run the same commands as above
Security tip: Store your
private_key.pemfile securely. You will need the contents of this file when connecting to Gainium. Never share your private key with anyone.
Step 5 – Label/Name Your Key and Enter Public Key#
When you have several APIs, having a proper name makes it easier to manage them. Name your key (for example, "Gainium") and then paste your public key from public_key.pem.

Security tip: Enable two-factor authentication (2FA) on your account before creating an API.
Step 6 - Enter 2FA Codes#
After clicking the "Create" button, you will be asked to enter 2FA codes.

Your API has now been created. Copy your API Key now as you'll need it for Gainium.
Step 7 - Edit the API Restrictions#
Click on "Edit restrictions". Then, click on "Restrict access to trusted IPs only (Recommended)" and input the following IPs:
78.128.60.89 78.128.43.82 78.128.8.36 78.128.43.168 217.174.152.25 62.84.191.108 62.84.191.109 62.84.191.110 62.84.191.111 62.84.191.112
Enable the necessary permissions for trading and click "Confirm".

Step 7.b (Optional) Enable Symbol Whitelist#
If you only trade specific token pairs, you can enhance the security of your API keys even further by activating token symbol whitelist. This will prevent a hacking technique known as "Contra trading". Contra trading is a market manipulation tactic by which a hacker generates enough trading volume to move the market in their desired direction and profit from that move. Generally, it involves lower cap tokens, as they require less volume to produce price movements. Enabling Symbol Whitelist will prevent hackers from using such tactics with your API keys.


Step 8 – Connecting Gainium to Binance#
Login to the dashboard of gainium.io and click on the Exchanges icon, then "Add new".

On the pop-up window, make sure that you have selected "Real" exchange. Then select "Binance" from the dropdown menu.
For ED25519 keys, you need to enter:
- API Key: The API key from Binance
- Private Key: The entire contents of your
private_key.pemfile, including the header and footer lines

The private key should include everything: -----BEGIN PRIVATE KEY-----, the key content, and -----END PRIVATE KEY-----.

Click "Add exchange" and wait a few seconds for the system to retrieve your Binance account data.
That's it! Your Gainium account is now connected to Binance with the new ED25519 keys.
Updating Existing Binance Connections#
If you already have a Binance connection in Gainium and need to update to ED25519 keys:
- Generate a new ED25519 key pair following Step 4 above
- Create a new API key in Binance with the Self-generated option
- In Gainium, go to your Exchanges page
- Click on your existing Binance exchange and select "Edit"
- Update the API Key and Private Key with your new credentials
- Save the changes
After saving, verify that the exchange status shows "OK":

Your bots and settings will remain intact — only the API credentials will be updated.