binance / binance-connector-dotnet

Lightweight connector for integration with Binance API
MIT License
207 stars 69 forks source link

Documentation: Get confused about different API terms. #24

Closed zydjohnHotmail closed 2 years ago

zydjohnHotmail commented 2 years ago

Description

Hello: I spent some time to learn on using API. But I found it is rather confusing to understand. Usually, I can have Private key and can generate a public key from a private key, and have Passphrase to control access to keys, right? When I get my API keys, I found I have one API key (64 letters and digits combination) and one secret key (64 letters and digits combination). But which one is the private key, is this API key (64 letters and digits combination). If yes, then how I can get one public key from this private key? If no, then let me know how I can get one private key? By the way, what is the purpose for this secret key? And how I can get Passphrase? If not set, then is it empty?

tantialex commented 2 years ago

If yes, then how I can get one public key from this private key?

While Binance's concept of API key and Secret key are similar to those of generic cryptography public key (can be shared) and private key (must not be shared), the difference is that the API key is not derived from the secret key.

When sending a request to an authorized endpoint (such as a USER_DATA endpoint), you must include the API key in the request header X-MBX-APIKEY and use the Secret key to encode the signature of the request.

All is explained in the documentation here. https://binance-docs.github.io/apidocs/spot/en/#endpoint-security-type

zydjohnHotmail commented 2 years ago

Hello: I look some 3rd party program. Most of them use the ordinary cryptography terms. So, if I want to use some 3rd party program to do the job as this repo does. The program asks me to provide: private key, public key and Passphrase. Then what I should do? Can I provide API key as private key? And use OpenSSL to generate a public key from the API key, and then use Secret key as Passphrase? As I see there are so many different exchanges, and different keys. If each exchange has its own ways of API programming, it is very confusing. If all the exchanges can have the same mechanism: private key => public key and use Passphrase to control access to keys, then it will be rather easy to understand. I don't have to learn so many different things.

tantialex commented 2 years ago

The program asks me to provide: private key, public key and Passphrase.

Binance Exchange API does not require a passphrase. Only an API Key and Secret Key. I suggest opening an issue on the third-party library instead.

Can I provide API key as private key? And use OpenSSL to generate a public key from the API key, and then use Secret key as Passphrase?

This is not required.

As I see there are so many different exchanges, and different keys. If each exchange has its own ways of API programming, it is very confusing.

Each Binance exchange may use the same set of credentials and share the same authentication process.