Coinbase Logo

Unlocking the future of NFTs: exploring ERC-6551 Token Bound Accounts

Tl;dr: Token Bound Accounts (TBAs) add additional utility to new and existing NFTs by equipping them with Smart Wallets. TBAs can be used to receive money or other NFTs, reduce operational expenses of investment portfolios, and enable provenance for commodities like coffee. Deploy your NFT and Token Bound Account on Base with our official guide.

By Patrick Hughes

Engineering

, August 31, 2023

u4RhB2I5.jpeg

In the world of blockchain and cryptocurrencies, innovation never sleeps. New ideas are constantly emerging to transform the landscape and make it more versatile, secure, and applicable than ever before. One such innovation is ERC-6551, a groundbreaking proposal by Benny Giang and Future Primitive that introduces the concept of Token Bound Accounts (TBAs). In this blog post, we’ll dive deep into the world of ERC-6551, demystifying its potential and applicability for business operators, developers, and crypto enthusiasts.

ERC-6551 and Smart Wallets

Smart Wallets are at the heart of ERC-6551’s innovation. Unlike traditional Externally Owned Accounts (EOAs), which are controlled by private keys, smart wallets are smart contract-based accounts with programmable features. These smart wallets can hold and manage assets, making them the perfect companion to the rising star of the crypto world: Non-Fungible Tokens (NFTs). In the case of ERC-6551, NFTs gain an exciting new dimension through their association with these smart wallets, forming Token Bound Accounts.

When NFTs are equipped with a smart wallet, a new realm of possibilities emerges. These token bound accounts not only store assets and facilitate transactions, but they also offer an immutable, onchain history of the NFT’s journey. Just as a family heirloom carries with it a rich and oftentimes documented history, NFTs with smart wallets possess an inherent, unalterable record of ownership, transactions, and utility. This remarkable feature captures the essence of provenance, ensuring that an NFT’s onchain activities are transparent and traceable.

This provenance of ownership ties directly to real-world goods like coffee, clothing, and art. ERC-6551 captures these real-world relationships and translates them into the digital realm. With every interaction and transaction recorded on the blockchain, the NFT’s journey becomes a part of an unchangeable narrative, adding depth and authenticity to its identity. This innovation empowers NFTs to transcend mere tokens and embrace their roles as unique, trackable entities. While onchain histories show NFT buy, sell, and mint actions today, they don't provide a comprehensive view of an NFT's journey, especially in the context of interactions with other assets or smart contracts. In contrast, the onchain history of a smart wallet records interactions that occur within the wallet itself, reflecting the NFT’s utility and engagement beyond mere transfers.  This means you can see how it interacts with other tokens, executes transactions, or engages with decentralized applications (dapps). 

NFTs, Smart Wallets, and Real-World Parallels

In the rapidly evolving landscape of blockchain technology, the marriage of NFTs, smart wallets, and their owners has given rise to real-world analogs that transcend industries and redefine ownership structures. Consider a family office —a steadfast entity managing a diverse portfolio spanning real estate, stocks, bonds, and other valuable assets. Traditionally, such a portfolio would entail complex transactions and interactions, each requiring meticulous orchestration. Enter the innovation of Token Bound Accounts (TBAs) — a revolutionary concept supported by the ERC-6551 standard. 

TBAs seamlessly connect subsidiary NFTs under a single, overarching NFT, ushering in a novel approach to managing and trading assets. This concept capitalizes on blockchain’s innate interoperability, facilitating the swift integration of innovative protocols. Through the lens of blockchain’s unwavering code-as-law principle, ERC-6551 opens the gateway for NFTs to embrace tokenized assets. By adhering to the ERC standard, any asset conforming to ERC token norms can be treated as such, amplifying the potential of this groundbreaking technology.

In the realm of tokenized real-world assets, a transformative advantage emerges for investors who often manage portfolios of diverse holdings such as real estate, stocks, bonds, and physical assets. Rather than navigating the intricate process of selling off each asset piece by piece, the innovation of token bound accounts brings a new level of efficiency. Imagine owning an ERC-721 token with a token bound account that aggregates several other ERC-721 tokens, each representing different assets. This consolidated ownership streamlines the process, enabling the sale of an entire portfolio through a single NFT. For instance, a family office can now offer their NFT holding a collection of tokenized real-world assets—ranging from real estate to stocks—allowing seamless trading, efficient settlement, and heightened liquidity. The elimination of intermediaries, trading hours, and increased transparency fuel this transformation, opening doors for wider participation and reducing barriers to entry. This approach is poised to democratize investment opportunities, making assets previously out of reach more accessible for a broader spectrum of investors. As the ownership landscape evolves, tokenized assets consolidate in a powerful NFT, offering a dynamic shift in how portfolios are managed, traded, and diversified.

Creating and Controlling Token Bound Accounts

Creating a Token Bound Account involves a few essential steps. As we transition from theory to practice, let’s explore each step through code snippets. The below code samples provide a glimpse into the process, but for the complete source code and detailed deployment scripts head over to the Base Guides GitHub page.

Step 1: Mint Your Unique NFT

Before delving into the world of TBAs, you’ll need an ERC-721 token —more commonly known as an NFT. This unique digital asset represents ownership of a distinct item, whether it’s a piece of art, a collectible, or even a game character. You can create and mint your own ERC-721 token using a suitable platform or library like OpenZeppelin.

Here is an example of minting an ERC-721 token using OpenZeppelin’s ERC721 contract that can be using an online IDE or on your local computer:

chart1

Step 2: Creating and Deploying the Registry

At the heart of ERC-6551 lies a decentralized registry, functioning somewhat like a virtual art gallery curator, but without the limitations of physical space or exclusive invitations. Imagine a place where NFTs establish their identity and ownership through a permissionless and trustless process. This registry creates an unbreakable bond between NFTs and their smart wallets, comparable to how a driver's license is issued by the DMV. The key distinction is that the ERC-6551's registry is fully permissionless and decentralized, empowering users to interact without intermediaries. This registry revolutionizes the NFT landscape, much like the internet transformed communication, by keeping tabs on the relationship between NFTs and their associated Token Bound Accounts.

Here's the astonishing twist: thanks to this registry, ERC-6551 is backwards compatible, allowing existing ERC-721 tokens, created before this proposal, the ability to have their own TBAs. It's as if a door to enhanced ownership has been opened for legacy NFTs, breathing new life into their potential. This compatibility bridges the gap between the past and the future, allowing both old and new to coexist harmoniously within the realm of ERC-6551.

The `createAccount` function in the provided sample ERC6551Registry contract facilitates the creation of a TBA by deploying a smart wallet with specified parameters.

By combining these parameters and hashing them using `Create2`, the function computes the TBA's address. The `_creationCode` function generates the bytecode for the smart wallet using the provided parameters. Once the TBA is created, the function emits an `AccountCreated` event containing relevant information about the newly created TBA.

Here's a snippet of the registry contract:

chart2

Step 3: Smart Wallet Deployment

Deploying a smart wallet is like setting up a personal bank account for an NFT. Just as you'd choose a bank to manage your funds, deploying a smart wallet assigns a contract to manage your NFT. Smart wallets are the guardians of your digital assets, equipped with essential interfaces for interaction and validation. They empower NFT owners to execute transactions, unlocking the full potential of their assets. Simply put, this contract enables the functionality of Token Bound Accounts. 

Here's a simplified code snippet for a smart wallet contract:

chart3

Step 4: Computing the Token Bound Account Address

With your ERC-721 token and smart wallet in place, it's time to compute the TBA address for each NFT. This address acts as the unique identifier for the NFT's interaction with the blockchain. This is where an NFT can be airdropped new tokens (ERC-20, ERC-721, etc.), sent ether, or viewed their transaction history on a block explorer like Basescan

chart4

For a detailed look at how to implement ERC-6551 including deployment scripts visit the Base Guides github.

Embracing the Future with ERC-6551

In the ever-evolving landscape of blockchain technology, ERC-6551’s TBAs stand as a testament to the power of innovation. With Smart Wallets and NFTs converging to create a new dimension of ownership, the potential applications are boundless. From democratizing investments to preserving provenance and history, ERC-6551 opens doors to a world where NFTs are not just tokens, but living, breathing entities with stories to tell. As business operators, developers, and crypto enthusiasts, you have the opportunity to be at the forefront of this revolutionary change. Explore the provided codebase on the Base Guides github and be part of the movement that shapes the future of NFTs. Embrace the power of Token Bound Accounts and embark on a journey where the boundaries of innovation are pushed, and new possibilities are unlocked. Together, we’re charting a path to a more connected, transparent, and exciting digital era.

Coinbase logo
Patrick Hughes

About Patrick Hughes

Senior Solutions Architect