# Account Handling

## Basic Steps

To access the bot, a user must first execute the command, "/register", when this is done, a database is filled in with the users discord ID along with a corresponding encrypted private key and address generated by eth\_accounts.

As an alternative to "/register," you can do "/import" to import an external private key into the wallet; this will go through essentially the same process as register but with a chosen private key. After a user executes the import command, they will be prompted in a DM to provide a private key\~ this should not be the key of a primary wallet, but instead a secondary wallet used purely for side-usage such as Amity. Keys of primary wallets should never leave your possession. Import is helpful for potentially bridging wallets over from another bot, or using a secondary MetaMask wallet. Import will overwrite any previous account.

#### How this account is handled post-registration

Once the user is registered, each command found under the "General Usage" category of commands loads the database entries relevant to the user and fetches the required information attached to the sender's discord ID.&#x20;

Through this, web3 commands can be done on behalf of the user's account. Allowing personal balances, transactions, etc. all attached to the wallet binded to the discord account though still allowing for the wallet to have complete autonomy outside of Amity.

<div align="left"><img src="https://3417688037-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MaujCOU1mFgyv1bc9Nt%2Fuploads%2FQWp0FUedvSLolBRoUZ0u%2Fregistration.drawio.png?alt=media&#x26;token=845fa5ef-972f-4e04-af81-afd3e7e2cf73" alt=""></div>

#### Balance fetching

After accounts are created and loaded using the above methodology, user's can execute `/balance` and by default, view their current amount of the default coin for whatever network they may be connected to. For example, if I register and am connected to Harmony, it will fetch my ONE balance with the `balanceOf` function. Additionally, tokens can be included in this balance display with corresponding commands `/addtoken` and `/deltoken`. Similar to metamask, Amity has no way to fetch the tokens present on a specific wallet, so instead it relies on the user to essentially tell Amity what tokens to look for via. either contract address or token shortcut.
