> For the complete documentation index, see [llms.txt](https://yuga.gitbook.io/zkyuga-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yuga.gitbook.io/zkyuga-whitepaper/developer-guide/erc721/transferownership.md).

# transferOwnership

The `transferOwnership` method is a feature specific to the ERC-721 token standard, enabling the current owners of non-fungible tokens (NFTs) to transfer ownership of those tokens to other Ethereum addresses. This operation is fundamental for actions like selling, gifting, or otherwise passing the rights and control of individual NFTs to different parties. The method is accessible through the `ERC721Instance` object, typically provided by client libraries such as `ZkyugaClient`.

### Method Signature

```javascript
async transferOwnership(to: string, tokenId: string, signer: WalletSigner): Promise<TransactionResponse>
```

#### Parameters

<table><thead><tr><th width="132">Parameter</th><th width="139">Type</th><th>Description</th></tr></thead><tbody><tr><td>to</td><td>string</td><td>The Ethereum address to which the ownership of the specified ERC-721 token should be transferred. Upon completion of the transfer, this address becomes the new owner of the token.</td></tr><tr><td>tokenId</td><td>string</td><td>The unique identifier associated with the particular ERC-721 token being transferred. This ID distinguishes individual non-fungible tokens within the contract.</td></tr><tr><td>signer</td><td>WalletSigner</td><td>An instance responsible for signing the transfer transaction. This is typically created using various mechanisms or methods provided by client libraries, ensuring that the initiator has the authority to transfer the token associated with the provided tokenId.</td></tr></tbody></table>

#### Returns

* A `Promise` resolving to a `TransactionResponse` object, which furnishes details about the transaction, including its status, transaction hash, and more.

### Usage Example

Begin by obtaining an instance of the desired ERC-721 token contract:

```javascript
const erc721 = zkyugaClient.getERC721Instance("your ERC-721 contract address here");
```

Then, employ the `transferOwnership` method to transfer an NFT:

```javascript
const recipient = "0xRecipientAddressHere";
const tokenId = "1010"; // Replace with your token ID
const signer = zkyugaClient.createWalletSigner("your private key");

const transactionResponse = await erc721.transferOwnership(recipient, tokenId, signer);
console.log(`Transaction Hash: ${transactionResponse.hash}`);
```

### Notes

* Prior to initiating the transfer, ensure that the signer possesses ownership of the token specified by `tokenId`.
* Always handle the `signer` securely to prevent the exposure of private keys in insecure environments..
* The function name `transferOwnership` may vary among different ERC-721 implementations. Some contracts might use alternative names such as transferFrom for this functionality. Always refer to the specific ERC-721 contract's documentation for precise details.

***
