Users can access the DeGate protocol via the Ethereum wallet. First-time users are required to register for a DeGate account, this process links their DeGate account's authority together with their wallet address.
Account Nodes in the Entire Merkle Tree
Referring to the above diagram about the entire merkle tree diagram with the account nodes, it can be seen that each account's node contains a DeGate account which stores the wallet address (owner), asset public key (publicKeyX & publicKeyY), trading key (appKeyX, appKeyY), account nonce (nonce), trading key permissions (disableAppKeySpotTrade/Withdraw/TransferToOther), and the root data (balanceRoot, storageRoot). There can be up to 4^16 account nodes which means that the DeGate protocol can support approximately 4.2 billion accounts. Every DeGate account is assigned with an AccountID in sequence, starting from 0 and increasing by 1 each time. 0 and 1 are reserved so the first user AccountID will start from 2.
Assigning a short AccountID to represent a long wallet address helps save the cost to perform zero-knowledge proof. From a user standpoint, it is unnecessary to understand AccountID as they will only be utilizing their wallet to access and use DeGate to perform operations such as withdrawals and transfers.
There is also a Nonce in the account node of the merkle tree that is called "Account Nonce". Currently, there are 2 different concepts of nonce: Account Nonce and KeyNonce. The table below describes their differences:
Asset Node under an Account Node
Each account will require assets before trading on DeGate can begin. Tokens can be either deposited from a wallet or transferred from other DeGate accounts. For deposits, all assets are stored in DeGate's smart contract and will be confirmed by zero-knowledge proof and updated to the respective DeGate account nodes and asset nodes in the merkle trees.
In other words, users cannot use their wallet funds directly with DeGate. They will have to deposit their assets to trade and withdraw their assets back to their wallet when done with trading. The need to deposit and withdraw may be a barriers to some users. However, in return, order placements and cancellations are free and instantaneous which is desirable for long-term and professional traders.
Some operations in DeGate require gas fees and will be paid from the account's assets.
On the protocol layer, any actions that deal with the account's assets will require a signed authorization from the wallet's private key and/or the asset private key. Users are responsible to make security precautions to safeguard these keys.