UpdateAccount with keyseed

The eddsaKey is generated by a keyseed, default format is 'Sign this message to access Loopring Exchange: %s with key nonce: %d', %s is exchange address, %d is nonce in Get api/v3/account.

for example:

Sign this message to access Loopring Exchange: 0x2e76EBd1c7c0C8e7c2B875b6d505a260C525d25e with key nonce: 0

We also support custom keyseed when updateAccount.

for example, you can change the string before 'with key nonce: 0' (must ends with 'with key nonce: %d')

Sign this message to access XXX website with key nonce: 0

1 Update Account with keySeed

POST api: api/v3/account

Note: after updateAccount, the nonce in Get api/v3/account will be incremented by 1

header: 
X-API-SIG = 0x05b49f99ac6d8f67d4519dfaf9b545dbc775dcc837441f85ef9aae74c83e5c2d700729cdba1d7a9cc818abb43a598cf1e4eeca547e4e6697ff18c4d2ac111ac21b03

request:
{
    "accountId": 11329,
    "ecdsaSignature": "0x05b49f99ac6d8f67d4519dfaf9b545dbc775dcc837441f85ef9aae74c83e5c2d700729cdba1d7a9cc818abb43a598cf1e4eeca547e4e6697ff18c4d2ac111ac21b03",
    "exchange": "0x2e76EBd1c7c0C8e7c2B875b6d505a260C525d25e",
    "maxFee": {
        "volume": "24000000000000",
        "tokenId": 0
    },
    "nonce": 0,
    "owner": "0x8656920c85342d646E5286Cb841F90209272ABeb",
    "publicKey": {
        "x": "0x20ba7bd404f259c3d49853d6a849425a983c24fc3c01be177f719e84ba776a8c",
        "y": "0x266d7e40dba375c90816287814f20b8e187227a6d05f17d2d329fefac9b782af"
    },
    "validUntil": 1899273791,
    "keySeed":"Sign this message to access Loopring Exchange: 0x2e76EBd1c7c0C8e7c2B875b6d505a260C525d25e with key nonce: 0"
}

response:
{
    "hash": "0x1d01dd0f4d7846a90235331798f4457829e72d8a4ed8d9393dd29c4859481e7b",
    "status": "processing",
    "isIdempotent": false
}

you can also refer to js sdk for updateAccount: https://github.com/Loopring/loopring_sdk/blob/master/src/tests/user.test.ts#L219

2 Get Account

Get API: api/v3/account

https://uat2.loopring.io/api/v3/account?owner=0x8656920c85342d646E5286Cb841F90209272ABeb

respone:
{
    "accountId": 11329,
    "owner": "0x8656920c85342d646E5286Cb841F90209272ABeb",
    "frozen": false,
    "publicKey": {
        "x": "0x20ba7bd404f259c3d49853d6a849425a983c24fc3c01be177f719e84ba776a8c",
        "y": "0x266d7e40dba375c90816287814f20b8e187227a6d05f17d2d329fefac9b782af"
    },
    "tags": "",
    "nonce": 1,
    "keyNonce": 1,
    "keySeed": "Sign this message to access Loopring Exchange: 0x2e76EBd1c7c0C8e7c2B875b6d505a260C525d25e with key nonce: 0"
}

Then use the keySeed to generate eddsaKey.

Your can refer to js sdk for generate eddsa keypair: https://github.com/Loopring/loopring_sdk/blob/master/src/api/sign/sign_tools.ts#L70

results matching ""

    No results matching ""