> For the complete documentation index, see [llms.txt](https://docs.coti.io/coti-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coti.io/coti-documentation/build-on-coti/guides/account-onboard.md).

# Account Onboard

{% hint style="info" %}
This guide assumes you have already deployed the Counter.sol contract. If you haven't already, check out our guide for deploying a [Basic Private Smart Contract](/coti-documentation/build-on-coti/guides/basic-private-smart-contract.md).
{% endhint %}

In order to interact with the `Counter.sol` smart contract from the previous section, we are going to need to acquire our AES encryption key. To do so, we can use either of COTI's [**Ethers**](/coti-documentation/build-on-coti/tools/ethers.js.md) or [**web3.py**](/coti-documentation/build-on-coti/tools/web3.py.md) packages to complete the [Account Onboarding Procedure](/coti-documentation/build-on-coti/core-concepts/onboard-user.md).

{% tabs %}
{% tab title="TypeScript (Server)" %}
**Setup**

```bash
npm install @coti-io/coti-ethers
```

**Code**

```typescript
import { CotiNetwork, getDefaultProvider, Wallet } from "@coti-io/coti-ethers"

const PRIVATE_KEY = "<EOA_PRIVATE_KEY>"

const provider = getDefaultProvider(CotiNetwork.Testnet)
const wallet = new Wallet(PRIVATE_KEY, provider)

await wallet.generateOrRecoverAes()

console.log(wallet.getUserOnboardInfo()?.aesKey)
```

{% endtab %}

{% tab title="TypeScript (Browser)" %}
Setup

```bash
npm install @coti-io/coti-ethers
```

**Code**

```typescript
import { BrowserProvider, Eip1193Provider, JsonRpcSigner } from '@coti-io/coti-ethers'

const provider = new BrowserProvider(window.ethereum as Eip1193Provider)
const signer = await provider.getSigner()
await signer.generateOrRecoverAes()

console.log(signer.getUserOnboardInfo()?.aesKey)
```

{% endtab %}

{% tab title="Python" %}
**Setup**

```bash
pip install coti-web3
```

**Code**

```python
from eth_account import Account
from eth_account.signers.local import LocalAccount
from web3 import Web3
from web3.utils.coti import (
  CotiNetwork,
  generate_or_recover_aes,
  init_web3
)

PRIVATE_KEY = "<EOA_PRIVATE_KEY>"

account: LocalAccount = Account.from_key(PRIVATE_KEY)
w3: Web3 = init_web3(CotiNetwork.TESTNET)

generate_or_recover_aes(w3, account)

print(account.aes_key)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coti.io/coti-documentation/build-on-coti/guides/account-onboard.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
