> ## Documentation Index
> Fetch the complete documentation index at: https://developers.circle.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Before reading these docs, install the relevant Circle Skill to get pre-loaded context — skills are LLM-optimized and cover architecture decisions, correct flows, and common pitfalls. In Claude Code: run /plugin marketplace add circlefin/skills then /plugin install circle-skills@circle. With Vercel Skills CLI: run npx skills add circlefin/skills. Available skills: use-usdc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-usdc/SKILL.md (balances, transfers, approvals on EVM and Solana); EURC has no skill — see https://developers.circle.com/stablecoins/what-is-eurc.md; bridge-stablecoin https://github.com/circlefin/skills/blob/master/plugins/circle/skills/bridge-stablecoin/SKILL.md (crosschain transfers via CCTP, USDC, EURC, and third-party assets); use-arc https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-arc/SKILL.md (Arc chain config, contract deployment, USDC bridging — Arc docs: https://docs.arc.io/llms.txt); use-circle-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-circle-wallets/SKILL.md (choose wallet type); use-developer-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-developer-controlled-wallets/SKILL.md (custodial wallets for payouts and treasury); use-user-controlled-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-user-controlled-wallets/SKILL.md (embedded wallets with Web2 login); use-modular-wallets https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-modular-wallets/SKILL.md (smart contract wallets with passkeys and ERC-4337); use-gateway https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-gateway/SKILL.md (unified USDC balance, nanopayments); use-smart-contract-platform https://github.com/circlefin/skills/blob/master/plugins/circle/skills/use-smart-contract-platform/SKILL.md (deploy, interact, monitor contracts). Pair any skill with the Circle MCP server for live SDK signatures, contract addresses, and chain IDs: {"mcpServers":{"circle":{"url":"https://api.circle.com/v1/codegen/mcp"}}}.
> Read the product overview first. Each product has an overview explaining when and why to use it. Read it before quickstarts.
> Pick the right wallet type. Developer-controlled (you hold keys), user-controlled (end user holds keys via PIN/social login), or modular (smart contract wallets with passkeys). See https://developers.circle.com/wallets.md.
> Use CCTP V2 for crosschain transfers. CCTP natively transfers USDC and EURC via burn-and-mint, and supports permissionless wrapping of third-party assets via lock-and-mint. V1 is legacy; always use V2 unless V1 is specified or the chain requires it (Noble, Sui, and Aptos still require V1). Migration guide: https://developers.circle.com/cctp/migration-from-v1-to-v2.md.
> Use Bridge Kit for frontend bridging. Wraps CCTP with a simpler SDK for user-facing apps. Use CCTP directly for backend transfers.
> Gas Station vs Paymaster. Gas Station sponsors gas for Circle Wallet transactions. Paymaster lets users pay gas in USDC. Different use cases — read both overviews.
> Gateway Nanopayments for sub-cent payments. Gasless USDC micropayments down to $0.000001 via x402 and batched settlement. For pay-per-request APIs, AI agent payments, streaming.
> Look up USDC addresses per chain. Never hardcode — use https://developers.circle.com/stablecoins/usdc-contract-addresses.md.
> Prefer SDKs over raw API calls. Node.js and Python SDKs handle auth, retries, and errors.
> API key required. Bearer token in Authorization header. Testnet and mainnet use separate keys and may use different base URLs depending on the product.
> Set up webhooks when available. Most operations are async. Webhooks deliver transaction confirmations and state changes.
> When calling list endpoints, paginate using pageSize and pageAfter until no nextPageAfter cursor is returned—stopping at the first page silently misses records.
> Building an AI agent? Start with the Agent Stack—Circle CLI, agent wallets, and nanopayments built for autonomous use cases: https://developers.circle.com/agent-stack.md.

# Smart contract account (SCA) upgrades

> How to upgrade Smart Contract Account (SCA) wallets to a newer contract version, without changing the wallet address.

When Circle releases a newer version of the SCA contract, you can upgrade
existing wallets to pick up bug fixes and product improvements. The wallet's
address and assets stay the same across an upgrade. You initiate every upgrade
yourself. Circle never upgrades wallets on your behalf.

MSCA wallets have a single implementation and can't be upgraded.

## Supported migration paths

| Source version | Destination version | Contract function |
| - | - | - |
| `circle_4337_v1` | `circle_6900_singleowner_v2` | `upgradeToAndCall(address,bytes)` |
| `circle_6900_singleowner_v1` | `circle_6900_singleowner_v2` | `upgradeTo(address)` |

## Upgrade an SCA wallet

<Note>
  If your wallet is on `circle_4337_v1`, complete the
  [prerequisites](#prerequisites-for-circle_4337_v1) before upgrading.
</Note>

Call the endpoint that matches your wallet product:

* **Developer-controlled**:
  [`POST /developer/transactions/walletUpgrade`](/api-reference/wallets/developer-controlled-wallets/create-developer-transaction-wallet-upgrade)
* **User-controlled**:
  [`POST /user/transactions/walletUpgrade`](/api-reference/wallets/user-controlled-wallets/create-user-transaction-wallet-upgrade-challenge),
  then follow the standard challenge approval flow. Identify the wallet with
  either `walletId` or `walletAddress` plus `blockchain`.

<Tip>
  Filter `GET /wallets` by the `scaCore` query parameter to list SCA wallets
  eligible for an upgrade.
</Tip>

The upgrade appears in [Circle Console](https://console.circle.com/) and the
transaction APIs as a contract execution transaction. When it reaches
`COMPLETE`, the wallet's SCA version updates in the responses from
`GET /wallets/{id}` and `GET /wallets`. Your wallet remains usable during the
upgrade transaction.

### Prerequisites for `circle_4337_v1`

`circle_4337_v1` wallets require these prerequisites before the upgrade endpoint
succeeds.

<Steps>
  <Step title="Lazy-deploy the wallet">
    `circle_4337_v1` wallets must be deployed onchain before an upgrade can
    run. To trigger deployment, initiate any outbound transaction (transfer
    or contract execution) from the wallet. See
    [account types](/wallets/account-types) for background on SCA lazy
    deployment.
  </Step>

  <Step title="Fund the owner address on testnet">
    On testnet, fund the wallet's owner address with native token before the
    upgrade transaction runs. On mainnet, `circle_4337_v1` wallets already
    received an airdrop that covers the upgrade fee, so you can skip this
    step.

    Fetch the owner address using
    [`POST /contracts/query`](/api-reference/contracts/smart-contract-platform/query-contract):

    <CodeGroup>
      ```typescript Node.js SDK theme={null}
      response = await client.queryContract({
        abiFunctionSignature: "owner()",
        address: "<circle_4337_v1-sca-wallet-address>",
        blockchain: "<wallet-blockchain>",
        abiJson:
          '[{"inputs": [],"name": "owner","outputs": [{"internalType": "address","name": "","type": "address"}],"stateMutability": "view","type": "function"}]',
      });
      ```

      ```python Python SDK theme={null}
      api_instance = smart_contract_platform.InteractApi(scpClient)
      try:
          request = smart_contract_platform.ReadContractStateRequest.from_dict({
              "abiFunctionSignature": "owner()",
              "address": "<circle_4337_v1-sca-wallet-address>",
              "blockchain": "<wallet-blockchain>",
              "abiJson": "[{\"inputs\": [],\"name\": \"owner\",\"outputs\": [{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"}],\"stateMutability\": \"view\",\"type\": \"function\"}]"
          })
          response = api_instance.query_contract(request)
      except smart_contract_platform.ApiException as e:
          print("Exception when calling InteractApi->read_contract: %s\n" % e)
      ```

      ```bash cURL theme={null}
      curl --request POST \
        --url https://api.circle.com/v1/w3s/contracts/query \
        --header "Authorization: Bearer $API_KEY" \
        --header 'accept: application/json' \
        --header 'content-type: application/json' \
        --data '{
            "abiFunctionSignature": "owner()",
            "address": "<circle_4337_v1-sca-wallet-address>",
            "blockchain": "<wallet-blockchain>",
            "abiJson": "[{\"inputs\": [],\"name\": \"owner\",\"outputs\": [{\"internalType\": \"address\",\"name\": \"\",\"type\": \"address\"}],\"stateMutability\": \"view\",\"type\": \"function\"}]"
          }'
      ```
    </CodeGroup>

    Response:

    ```json Response body theme={null}
    {
      "data": {
        "outputData": "0x...",
        "outputValues": ["<owner-address>"]
      }
    }
    ```

    The first entry in `outputValues` is the owner address. Send it enough
    native token to cover roughly 300,000 gas. Approximate costs:

    * **ETH-SEPOLIA**: 300,000 gas × 30 Gwei ≈ `0.009 ETH`
    * **MATIC-AMOY**: 300,000 gas × 150 Gwei ≈ `0.045 POL`
  </Step>
</Steps>

## Contract versions

Use the factory and implementation addresses to verify onchain deployments.
Addresses are the same on mainnet and testnet.

| Type | Version | Description | Factory address | Implementation address |
| - | - | - | - | - |
| SCA | `circle_6900_singleowner_v3` | ERC-6900 v0.7, ERC-4337 v0.6. Single owner address; supports batching multiple user operations in one transaction. | `0xf61023061ed45fa9eAC4D2670649cE1FD37ce536` | `0xD206aC7fEf53d83ED4563E770b28Dba90D0D9eC8` |
| MSCA | `circle_6900_v1` | ERC-6900 v0.7, ERC-4337 v0.7. Any ownership type (single owner, multiple owners, passkeys, multisig); supports batching multiple user operations in one transaction. | `0x0000000DF7E6c9Dc387cAFc5eCBfa6c3a6179AdD` | `0xA70F1296869DA9D7CB69578123F21888E6dB2B62` |

<Note>
  Because MSCA wallets are proxy contracts, block explorers display the wallet
  address's contract name as `ERC1967Proxy` rather than `UpgradeableMSCA`.
</Note>

## How upgrades work

SCA and MSCA wallets use the
[ERC-1967](https://docs.openzeppelin.com/contracts/5.x/api/proxy#ERC1967Proxy)
proxy pattern. The proxy contract at your wallet address delegates calls to a
separate implementation contract that holds the actual logic. An upgrade points
the proxy at a new implementation address, which is why the wallet address stays
the same.

The upgrade endpoint executes one of these functions on the proxy:

* `upgradeTo(address)`
* `upgradeToAndCall(address,bytes)`
