Loopring Dev Docs
  • Introduction
  • Endpoints
  • SDK
    • SDK Guides
    • Test Mock Data
      • Mock Account
      • Mock provider
      • Mock ERC20 Token Map
      • Mock AMM MAP
      • Mock EIP712 Typed Data
      • Mock Generate eddsaKey
  • Glossary
  • 🗳️Loopring Account
    • Introduction
    • SDK Guides
      • Setup a Loopring Account
      • Unlock Account (Login)
    • API References
      • Get Account info
        • Sample code
      • Update EddsaKey
        • Sample code
      • Get apiKey
        • Sample code
      • Update apiKey
        • Sample code
  • 🎨CounterFactual NFT
    • Introduction
      • Compute NFT Address API
      • When to deploy counterfactual NFT contracts?
    • SDK Guides
      • Deposit NFT
      • Create Collection
      • Mint Counterfactual NFT
      • Transfer NFT
      • Deploy NFT
      • Withdraw NFT
      • Trade NFT
        • Validate NFT Order
      • Meta & IPFS
    • API References
      • NFT Collection
        • Create collection
          • Sample code
        • Edit collection
          • Sample code
        • Delete collection
          • Sample code
        • List owned collections
          • Sample code
        • List user's NFTs under one collection
          • Sample code
        • List user's NFT balances group by Collection ID
          • Sample code
        • List all NFTs of a collection
          • Sample code
        • Get collection by Collection ID
          • Sample code
        • Get collections by contract address
          • Sample code
      • Get NFT Assets
        • Sample code
      • Get NFT Balances
        • Sample code
      • Mint NFT
        • Sample code
      • Transfer NFT
        • Sample code
      • Validate NFT Order
        • Sample code
      • Trade NFT
        • Sample code
      • Deploy NFT TokenAddress
        • Sample code
      • Withdraw NFT
        • Sample code
      • Get NFT Transactions
        • Sample code
      • Get NFT Trade History
        • Sample code
      • Get AvailableBroker
        • Sample code
      • Get NFT Info
        • Sample code
      • Get NFT Data
        • Sample code
      • Get NFT Holders
        • Sample code
  • 🪙ERC20 Tokens
    • Introduction
    • SDK Guides
      • Transfer ERC20
      • Withdraw ERC20
      • Deposit ERC20
      • Order ERC20
    • API References
      • Get Assets
        • Sample code
      • Transfer
        • Sample code
      • Submit Order
        • Sample code
      • Cancel Order
        • Sample code
      • Withdraw
        • Sample code
      • Get Transactions
        • Sample code
      • Get Orders
        • Sample code
      • Get Trade History
        • Sample code
  • 🔬Resources
    • Advanced
      • UpdateAccount with custom seed
      • Pay payee updateAccount fee
      • Common error and solutions
      • Submit erc20 order
    • Common Info
      • Get relayer current time
        • Sample code
      • Get exchange info
        • Sample code
      • Get token info
        • Sample code
      • Get markets info
        • Sample code
    • Error codes
    • Fees
      • GET ERC20 Offchain Fee
        • Sample code
      • GET ERC20 Order Fee
        • Sample code
      • GET NFT Offchain Fee
        • Sample code
      • GET NFT Order Fee
        • Sample code
      • SDK Fees
    • Layer 2 block info
      • Get pending transactions
    • Request signing
      • Special API Request Signatures
      • Off-chain Request Signatures
      • Extra ECDSA authentic in header
    • Signature
      • ECDSA signature
        • ECDSA key generation
        • ECDSA sign
        • ECDSA verify signature
      • EdDSA signature
        • EdDSA key generation
        • EdDSA sign
        • EdDSA verify signature
      • SDK Signature
        • Mock Signature
    • Smart Contracts
    • Storage Id
      • Sample code
    • WebSocket
      • Account Notification
      • Order Notification
      • Orderbook Notification
      • Trade Notification
      • Ticker Notification
      • Candlestick Notification
      • AMM Pool Snapshot Notification
      • Block Generation Notification
    • Loopring Smart Wallet
      • Signature and verification
Powered by GitBook
On this page
  • 1. Update Account with keySeed
  • 2. Get Account

Was this helpful?

  1. Resources
  2. Advanced

UpdateAccount with custom seed

PreviousAdvancedNextPay payee updateAccount fee

Last updated 2 years ago

Was this helpful?

The eddsaKey is generated by a keyseed, default format is Sign this message to access Loopring Exchange: %s with key nonce: %d

  • %s is

  • %d is nonce in

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 end with 'with key nonce: %d')

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

1. Update Account with keySeed

POST api:

Note: after updateAccount, the nonce in 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
}

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

2. Get 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.

Please refer to js sdk for generating EdDSA keypair: https://github.com/Loopring/loopring_sdk/blob/master/src/api/sign/sign_tools.ts#L70

Get API:

🔬
exchange address
Get api/v3/account
api/v3/account
Get api/v3/account
api/v3/account