> For the complete documentation index, see [llms.txt](https://www.ankitavirani.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.ankitavirani.com/experience/protocols/ercs-and-eips/erc-6551.md).

# ERC-6551

## ERC-6551: Non-Fungible Token Bound Accounts 🔗

ERC-6551 proposes a standard for creating unique blockchain accounts for non-fungible tokens (NFTs). This allows each NFT to own assets and interact with applications, effectively turning them into smart contract wallets.

Key features of ERC-6551:

* Each NFT can have its own account to hold assets and execute transactions
* Enables NFTs to own other NFTs, creating complex ownership structures
* Allows for the creation of "nested NFTs" and more complex digital asset management

Example of creating an account for an NFT:

```solidity
interface IERC6551Registry {
    function createAccount(
        address implementation,
        uint256 chainId,
        address tokenContract,
        uint256 tokenId,
        uint256 salt,
        bytes calldata initData
    ) external returns (address);
}

contract NFTWallet {
    IERC6551Registry private registry;
    
    constructor(address _registry) {
        registry = IERC6551Registry(_registry);
    }
    
    function createAccountForNFT(
        address tokenContract,
        uint256 tokenId
    ) external returns (address) {
        return registry.createAccount(
            address(this),  // implementation
            block.chainid,  // chainId
            tokenContract,
            tokenId,
            0,  // salt
            ""  // initData
        );
    }
}
```

These ERCs represent significant advancements in Ethereum's capabilities, enabling more flexible and powerful smart contract interactions and asset management.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://www.ankitavirani.com/experience/protocols/ercs-and-eips/erc-6551.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.
