# Utiliser l'abstraction de compte

## Qu’est-ce que l’abstraction de compte ?

L’abstraction de compte est une technologie blockchain qui permet aux utilisateurs d’utiliser des contrats intelligents comme comptes, les rendant entièrement programmables.

Elle vise à rendre les comptes utilisateurs plus flexibles et fonctionnels, améliorant ainsi l’expérience utilisateur.

## Qu’est-ce que cela signifie pour les développeurs de Chiliz Chain ?

En mettant en œuvre l’AA, les développeurs pourraient améliorer l’expérience utilisateur de leur projet : des interactions plus simples avec Chiliz Chain signifient une application plus conviviale.

## Comment le faire avec Biconomy ?

Biconomy fournit un SDK d’abstraction de compte full-stack, qui donne accès aux Smart Accounts : <https://docs.biconomy.io/account>

Selon Biconomy elle-même, il existe 4 façons d’exploiter leur stack AA sur Chiliz Chain :

* Transactions sans frais de gas
* Transactions groupées
* Portefeuilles de contrats intelligents (y compris la connexion sociale)
* Modules incluant les clés de session, le validateur multichaîne, la récupération de compte, et bien plus encore !

Biconomoy a une belle page de démarrage rapide : <https://docs.biconomy.io/quickstart>

L’exemple de code utilise le réseau Polygon Mumbai, et vous pouvez l’adapter à Chiliz, comme ceci :

```typescript
import {
  Hex,
  createWalletClient,
  encodeFunctionData,
  http,
  parseAbi,
  zeroAddress,
} from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { ChainId } from '@biconomy/core-types'
import { createSmartAccountClient } from "@biconomy/account";

const bundlerUrl =
  "https://bundler.biconomy.io/api/v2/80001/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44"; // Trouvé sur https://dashboard.biconomy.io

export const createAccountAndMintNft = async () => {
  // ----- 1. Générer un EOA à partir de la clé privée
  const account = privateKeyToAccount("0x" + "PRIVATE_KEY");
  const client = createWalletClient({
    account,
    chainId: ChainId.CHILIZ_TESTNET, // ou ChainId.CHILIZ_MAINNET,
    transport: http(),
  });
  const eoa = client.account.address;
  console.log(`Adresse EOA : ${eoa}`);

  // ------ 2. Créer une instance de compte intelligent Biconomy
  const smartAccount = await createSmartAccountClient({
    signer: client,
    bundlerUrl,
  });
  const saAddress = await smartAccount.getAccountAddress();
  console.log("Adresse SA", saAddress);
};
createAccountAndMintNft();
```

N’oubliez pas les identifiants de chaîne Chiliz :

* `CHILIZ_MAINNET = 88888`
* `CHILIZ_TESTNET = 88882`

De plus, lorsque vous travaillez avec Biconomy, notez que Chiliz a [sa propre adresse d’entrypoint](https://docs.biconomy.io/contracts#entry-points), pour le mainnet et le testnet : [0x00000061FEfce24A79343c27127435286BB7A4E1](https://scan.chiliz.com/address/0x00000061FEfce24A79343c27127435286BB7A4E1/contracts#address-tabs)

C’est important lorsque vous utilisez le [Bundler](https://docs.biconomy.io/bundler) ou [Paymaster](https://docs.biconomy.io/paymaster):

```typescript
// CC2 a sa propre adresse d’entrypoint
const CHILIZ_BUNDLER_ENTRYPOINT_ADDRESS='0x00000061FEfce24A79343c27127435286BB7A4E1'

const bundler = new Bundler({
    bundlerUrl: `https://bundler.biconomy.io/api/v2/${ChainId.CHILIZ_TESTNET}/nJPK7B3ru.dd7f7861-190d-41bd-af80-6877f74b8f44`,
    chainId: ChainId.CHILIZ_TESTNET,
    entryPointAddress: CHILIZ_BUNDLER_ENTRYPOINT_ADDRESS,
})
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chiliz.com/fr-ai/develop/advanced/use-account-abstraction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
