dYdX users are identified within the exchange by their Stark Key which is a public key defined over a Stark-friendly elliptic curve that is different from the standard Ethereum elliptic curve. The Stark Key represents the x coordinate of a point on the Stark-friendly elliptic curve. In order to associate dydX users with Ethereum account addresses, a user must first request to sign the linkage of an Ethereum key to a Stark Key and then register the Stark Key on dYdX’s smart contract before any other user operation can take place.
There are three levels of authentication to be considered when using dYdX. All signing can be handled directly by the client libraries.
Ethereum Key Authentication
The highest level of authentication is via an account's Ethereum private key. The Ethereum key remains in control of an account's funds while they are within the L2 system. This includes the ability to forcibly close an account's positions and exit the system, in the event that the L2 operators (dYdX and Starkware) were to unexpectedly go offline or otherwise censor requests.
Ethereum key authentication is required for the following operations:
Register a new user or STARK key
Create, list, or delete API keys
Request a forced withdrawal or forced trade
STARK Key Authentication
Within the L2 system, authentication is handled by a separate key pair, known as the account's STARK key pair.
STARK key authentication is required for the following operations:
Place an order
API Key Authentication
The third level of authentication consists of the API key pairs, which are used solely to authenticate API requests made to dYdX. This includes operations such as canceling orders or retrieving an account's fills, which do not affect the L2 system.
All requests which are not signed by an Ethereum key and which are made to private endpoints require an API key signature.
STARK Key Cryptography
The STARK and API keys are ECDSA key pairs on the STARK curve. More info on the cryptography used on L2 is available in Starkware's documentation.
You can read more about our authors here.