Generating and Preparing the Secret Key
2 мин. чтения
🔐 In some wallets (such as OKX), the private key is stored in base58 format, especially for EVM networks. For Solana, base64 format is used, and it must be obtained separately.
🔑 How to Get the EVM Private Key from OKX #
- Open the OKX WALLET app and go to Wallet Settings.
- Select Manage Wallets — find your wallet (e.g. “CRYPTA”).
- Tap the ⋮ (three dots) next to the wallet name → Seed Phrase — save it in a secure place.
- In the Account section, locate the desired wallet (e.g. DEXBOT) and tap on it.
- Tap on Private Key — the private key in
base58format will appear (starting with0xd...). - Important: when adding the key to your
.envfile, remove the0xdprefix. For example:
WALLET_SECRET_KEY=abcdef1234...
🧩 How to Get Solana Private Key (base64) #
- Use your base58 key or your seed phrase (mnemonic) obtained from OKX or another wallet (such as Phantom or Trust Wallet).
- Open the terminal and navigate to the folder containing the file:
cd ./MYBOTS
- Give the file execute permission if needed:
chmod +x keyall.bin
- Run the file:
./keyall.bin
- Select language (1 – Russian, 2 – English).
- Select the source of the key:
- 1. From Seed Phrase – enter 12 or 24 words (space-separated)
- 2. From Base58 – enter the private key in base58 format
- 3. From DEC Array – enter comma-separated numbers (e.g. 174,47,154,…)
- The program will show:
- Solana Public Address
- Private Key in Base58
- Private Key in Base64 (this is what goes into .env)
- DEC and HEX representations
- Copy the
Base64value into your.envfile:
SOLANA_SECRET_KEY=ndLVItNzBQ9Qr7kqglMu...==
🔐 How keyall.bin works #
- The program uses
base58,base64, andsolderslibraries to convert keys. - Supports three input methods:
- Seed Phrase – converted to seed bytes via BIP39, then to Solana key
- Base58 – directly decoded into private key
- DEC Array – number list converted to bytes, used to generate key
- If you have Python, you can install the required dependencies and simply run
keyall.py— it’s located in the main folder. - The
keyall.binversion is a standalone binary that works without any dependencies.
🗒️ Example: .env file structure #
WALLET_SECRET_KEY=abcdef1234... # EVM (without 0xd) SOLANA_SECRET_KEY=ndLVItN...== # Solana (base64)
❗If you see a base58 key, it’s EVM, not Solana #
- For Solana, you need a
base64key from a seed phrase or convert base58 using thekeyall.bintool. - Base58 keys cannot be used directly — Solana uses Ed25519 + base64 format.