Generalized Token-Linked Services
Welcome to ERC7656, a groundbreaking proposal that aims to revolutionize how Non-Fungible Tokens (NFTs) interact with smart contracts. Building upon the foundation laid by ERC6551, we introduce a more flexible and generalized approach to linking services with NFTs.
ERC6551 introduced the innovative concept of token-bound accounts, allowing each NFT to own a smart contract account. This was a significant leap forward, opening new possibilities for NFTs to interact with decentralized applications. ERC7656 builds on this foundation, extending its capabilities to unlock even more potential.
ERC6551 set the stage by enabling NFTs to have associated smart contract accounts, effectively giving NFTs their own wallets. This breakthrough allowed for more dynamic interactions and functionalities. Recognizing the immense potential of this concept, ERC7656 aims to generalize and expand upon it.
While ERC6551 focused on account-like contracts, ERC7656 broadens the scope to include any type of contract that can be linked to an NFT. This evolution is not about replacing ERC6551 but enhancing and complementing it. By embracing a more flexible approach, we can cater to a wider range of use cases and empower developers to innovate without constraints.
The synergy between ERC6551 and ERC7656 exemplifies how building upon established standards can lead to greater advancements in the blockchain ecosystem. Without the pioneering work of ERC6551, the ideas presented in ERC7656 would not have been possible.
ERC7656 reimagines the way NFTs interact with smart contracts by removing unnecessary restrictions and embracing flexibility. Here's how:
The Ethereum ecosystem has witnessed a rapid increase in the number of ERC standards, each aiming to introduce new functionalities or address specific use cases. While innovation is essential, this proliferation of ERCs can lead to several challenges:
ERC7656 offers a solution by allowing developers to deploy services that extend the capabilities of standard ERC721 NFTs without creating new ERCs. Instead of modifying the core ERC721 standard or integrating numerous extensions, you can deploy specialized ERC7656 services linked to your NFTs.
Examples of Use Cases:
By using ERC7656 services, developers can:
Conclusion:
ERC7656 empowers developers to overcome the limitations posed by ERC proliferation. By deploying flexible and modular services linked to NFTs, you can innovate rapidly without the overhead of integrating multiple ERC standards or worrying about future obsolescence.
ERC7656 has an official reference implementation available on GitHub:
github.com/crunaprotocol/erc7656
The following bytecode:
0x608060405234801561001057600080fd5b506102ac806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806301ffc9a714610046578063188db64e1461007f578063de307f46146100aa575b600080fd5b61006a6100543660046101db565b6001600160e01b0319166318d7b92160e31b1490565b60405190151581526020015b60405180910390f35b61009261008d366004610228565b6100bd565b6040516001600160a01b039091168152602001610076565b6100926100b8366004610228565b610121565b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b60015284601552605560002060601b60601c60005260206000f35b600060806024608c376e5af43d82803e903d91602b57fd5bf3606c5285605d52733d60ad80600a3d3981f3363d3d373d3d3d363d7360495260ff60005360b76055206035523060601b600152846015526055600020803b6101cb578560b760556000f5806101975763d786d3936000526004601cfd5b80606c52508284887fc6989e4f290074742210cbd6491de7ded9cfe2cd247932a53d31005007a6341a6060606ca46020606cf35b8060601b60601c60005260206000f35b6000602082840312156101ed57600080fd5b81356001600160e01b03198116811461020557600080fd5b9392505050565b80356001600160a01b038116811461022357600080fd5b919050565b600080600080600060a0868803121561024057600080fd5b6102498661020c565b945060208601359350604086013592506102656060870161020c565b94979396509194608001359291505056fea2646970667358221220a1eb08bd0d109d374fd4407e83d3b08f6b15af09e7c6a54b68d446696c062ad764736f6c63430008160033
has been deployed to erc7656.eth
, i.e.:
0x7656f0fB4Ca6973cf99D910B36705a2dEDA97eA1
using the following salt:
0x765600000000000000000000000000000000000000000000000000000000cf7e
The deployment has been made on the following networks:
The code has been verified on most mainnets. For deployment details, refer to contracts/bytecode.json
in the GitHub repository.
Notice that you can use it for your convenience, or deploy your own version where you prefer.
You can install ERC7656 as a dependency via npm:
npm install erc7656 @openzeppelin/contracts
Make your NFT able to deploy plugins:
// SPDX-License-Identifier: MIT // Compatible with OpenZeppelin Contracts ^5.0.0 pragma solidity ^0.8.20; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {ERC7656DeployLib} from "erc7656/utils/ERC7656DeployLib.sol"; contract MyExpandableToken is ERC721, Ownable { error NotTheTokenOwner(); constructor(address initialOwner) ERC721("MyExpandableToken", "MET") Ownable(initialOwner) { } function safeMint(address to, uint256 tokenId) public onlyOwner { _safeMint(to, tokenId); } function deployContractsOwnedByTheTokenId( address implementation, bytes32 salt, uint256 tokenId ) external payable virtual { if (_msgSender() != ownerOf(tokenId)) revert NotTheTokenOwner(); // Passing address(0) as the registry address because we use the canonical one ERC7656DeployLib.deploy(implementation, salt, address(this), tokenId, address(0)); } }
To create your service, extend erc7656/ERC7656Service.sol
or erc7656/extensions/ERC7656ServiceExt.sol
.
Note: Anyone can deploy a service owned by a specific token using whatever salt they prefer. To avoid security issues, design your initial setup so that, regardless of who deploys it, the result behaves as expected. For example, if a service needs information from the token, the service should query the token directly rather than relying on external parameters during deployment. Passing parameters during deployment can open opportunities for malicious actors to manipulate the service's behavior.
The reference implementation is licensed under MIT.
ERC7656 is more than just a proposal—it's a continuation of the innovation sparked by ERC6551. Together, these standards pave the way for a more dynamic and versatile NFT ecosystem. We invite developers to collaborate, share ideas, and contribute to the evolution of NFT technology.
Whether you're an experienced developer or new to the space, your insights and contributions are invaluable. Join the discussion, contribute to the codebase, or start building with ERC7656 today.
Join the Discussion Read the Proposal