# Sub Accounts

MOSS supports the ability for a single signing key to support multiple wallet addresses.

When a user connects a wallet which has sub-accounts, they are asked which account they wish to use with your app.
After selecting, the sub-account wallet address is returned.

> [!NOTE]
> No additional work is required to support sub-accounts in your apps

## Signing
The key the user connects with has access to their smart account wallet on chain. When creating a sub-account, a new
smart account wallet is created and the main smart account wallet is granted admin permissions.

> [!NOTE]
> The smart account is granted admin permissions, not the key the user uses to access their smart account.

This approach allows a user to have multiple passkeys, recovery keys or other authentication methods access their
main account and then have their main account sign requests for sub-accounts.

When executing a transaction on a sub-account, it contains a request for it to be executed by the main account. The
user signs using their current key which has access to the main account which then resolves correctly on chain.

The actual transaction on chain shows as being from the sub-account as you would expect.

## Gas
It is not necessary for a sub-account to have gas. The main account can act as its own paymaster for its
sub-accounts when creating and signing transactions.

If a sub-account has a supported gas token, that gas will be used instead of the main account.

As with signing, this is completely transparent on chain with the resulting transaction showing as being executed by
the sub-account.

## Moving Funds Between Accounts
On the portfolio screen of the wallet, a user can use the `Send` action and then `One of your accounts` to transfer
funds between their sub-accounts and their main account.
