hello_loopring icon indicating copy to clipboard operation
hello_loopring copied to clipboard

How to generate the 192 bits `X-API-SIG` header (/api/v3/apiKey)

Open 26medias opened this issue 4 years ago • 1 comments

Hi,

I have exported my account data, I can run the basic keygen example (using python poseidon_hash_sample.py -a sign -i 1,2,3 -k 0x1), however I'm confused as to what data from my account settings (Public X, public Y, Private EDDSA) to pass to the keygen and in which format.

The doc seems to be missing that part.

My goal is to obtain my API key via /api/v3/apiKey, so I can then connect to the websockets (https://docs.loopring.io/en/websocket/overview.html)

Thanks!

26medias avatar Nov 29 '21 01:11 26medias

We have the api call here https://github.com/Loopring/hello_loopring/blob/0f86004f3695eb5296cad51a086bd360ed4cb1b7/sdk/loopring_v3_client.py#L407. You can flow the whole process to make your code work. Generally speaking, It is to sign the hash string of the whole request. The pseudo code is like

x_api_sig = eddsa_sign(poseidon_hash(sha256(url_request_string)))

yueawang avatar Dec 02 '21 09:12 yueawang