# How to transfer ownership of a Light Account

> Follow this guide to transfer ownership of a Light Account with

> For the complete documentation index, see [llms.txt](/docs/llms.txt).

Not all smart account implementations support transferring ownership (e.g. `SimpleAccount`). However, a number of the accounts in this guide and in Wallet APIs do, including `LightAccount`. Below are a few different ways to transfer ownership of an account (using `LightAccount` as an example).

## Usage

`LightAccount` exposes the following method which allows the existing owner to transfer ownership to a new owner address:

```solidity
function transferOwnership(address newOwner) public virtual onlyOwner
```

There are a number of ways to call this method using Wallet APIs.

### 1. Using `transferOwnership` client action

<CodeBlocks>

```ts example.ts
import { lightAccountClient } from "./client";
import { createLightAccountClient } from "@account-kit/smart-contracts";

// this will return the signer of the smart account you want to transfer ownerhip to
const newOwner = LocalAccountSigner.mnemonicToAccountSigner(NEW_OWNER_MNEMONIC);
const accountAddress = lightAccountClient.getAddress();

// [!code focus:99]
const hash = lightAccountClient.transferOwnership({
  newOwner,
  waitForTxn: true,
});

// after transaction is mined on the network,
// create a new light account client for the transferred Light Account
const transferredClient = await createLightAccountClient({
  transport: custom(smartAccountClient),
  chain: smartAccountClient.chain,
  signer: newOwner,
  accountAddress, // NOTE: you MUST specify the original smart account address to connect using the new owner/signer
  version: "v2.0.0", // NOTE: if the version of the light account is not v2.0.0, it must be specified here
});
```

```ts client.ts
import { LocalAccountSigner } from "@aa-sdk/core";
import { alchemy, sepolia } from "@account-kit/infra";
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { generatePrivateKey } from "viem/accounts";

export const lightAccountClient = await createLightAccountAlchemyClient({
  signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
  chain: sepolia,
  transport: alchemy({ apiKey: "YOUR_API_KEY" }),
});
```


</CodeBlocks>

Since `@alchemy/aa-accounts` exports a `LightAccount` ABI, the above approach makes it easy to transfer ownership. That said, you can also directly call `sendUserOperation` to execute the ownership transfer. As you will see below, however, it is a bit verbose:

### 2. Using `sendUserOperation`

<CodeBlocks>

```ts example.ts
import { encodeFunctionData } from "viem";
import { lightAccountClient } from "./client";

// this will return the address of the smart account you want to transfer ownerhip of
const accountAddress = lightAccountClient.getAddress();
const newOwner = "0x..."; // the address of the new owner

// [!code focus:99]
const result = await lightAccountClient.sendUserOperation({
  to: accountAddress,
  data: lightAccountClient.encodeTransferOwnership(newOwner),
});
// wait for txn with UO to be mined
await lightAccountClient.waitForUserOperationTransaction(result);
```

```ts client.ts
import { LocalAccountSigner } from "@aa-sdk/core";
import { alchemy, sepolia } from "@account-kit/infra";
import { createLightAccountAlchemyClient } from "@account-kit/smart-contracts";
import { generatePrivateKey } from "viem/accounts";

export const lightAccountClient = await createLightAccountAlchemyClient({
  signer: LocalAccountSigner.privateKeyToAccountSigner(generatePrivateKey()),
  chain: sepolia,
  transport: alchemy({ apiKey: "YOUR_API_KEY" }),
});
```


</CodeBlocks>

See the [`LightAccount`](/docs/wallets/smart-contracts/other-accounts/light-account/) docs for more details about the `LightAccount` implementation.