Usersis MainStorage, LibConstants, MGovernance, MUsers¶
Users of the Stark Exchange 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. These keys may be generated using the same private key used by the user on Ethereum.
The Stark-friendly elliptic curve used is defined as follows:\[y^2 = (x^3 + \alpha \cdot x + \beta) \% p\]
where:\[\alpha = 1\]\[\beta = 3141592653589793238462643383279502884197169399375105820974944592307816406665\]\[p = 3618502788666131213697322783095070105623107215331596699973092056135872020481\]
In order to associate exchange users with Ethereum account addresses, a user must register the Stark Key on the exchange contract before any other user operation can take place. User registration is performed by calling
registerwith the selected Stark Key, representing an x coordinate on the Stark-friendly elliptic curve, and the y coordinate of the key on the curve (due to the nature of the curve, only two such possible y coordinates exist).
The registration is accepted if the following holds:
The key registered is not zero and has not been registered in the past by the user or anyone else.
The key provided represents a valid point on the Stark-friendly elliptic curve.
The linkage between the Ethereum key of the caller and the selected Stark Key is signed by the User Admin (typically the exchange operator).
If the above holds, the Stark Key is registered by the contract mapping it to the Ethereum key of the registering entity and vice versa. This mapping is later used to ensure that withdrawals from accounts mapped to the Stark Key can only be performed by a user authenticated with the associated Ethereum public key (see