For the complete documentation index, see llms.txt. This page is also available as Markdown.

Account Onboard

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.

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 or web3.py packages to complete the Account Onboarding Procedure.

Setup

npm install @coti-io/coti-ethers

Code

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)

Setup

npm install @coti-io/coti-ethers

Code

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)

Setup

Code

Last updated

Was this helpful?