Background
As mentioned here, we’re working on a BNS upgrade to overcome the challenges that are currently holding BNS back. We’re calling this upgrade BNS X.
What BNS X functionality will be available in this first release?
The major feature in this first release is the ability to ‘wrap’ an existing BNS name in a smart contract, which allows users to consolidate and manage multiple names under one wallet. This, combined with SIP9 compliance of these BNS X names, will automatically open up a ton of functionality to apps that support the Stacks NFT standard (like marketplaces and wallets).
What is changing on BNS v1?
Nothing.
What is changing with BNS X?
Because users will be wrapping their BNS name and transferring it to a smart contract, there will be a mismatch between the on-chain lookup of a BNS name and the ‘true’ owner.
Example: I wrap hank.btc:
- If you query the BNS contract, the owner of hank.btc will be a contract principal
- If you query my address in BNS, it’ll show that I don’t own any names
Users who wrap their names will want to still enjoy the benefits of showing their name ownership in apps. Similarly, users will want to know the true owner of a given name, even if it is wrapped.
To solve for this, we have a ‘registry’ contract that stores the relationship between a BNS name and a BNS X name. To get the true owner of a name, you can lookup who owns the ‘wrapped’ name.
Example:
- I wrap hank.btc
- I minted the nft
.bns-x::names
with some integer ID - An event is propogated with the data
{ wrapped-id: id, name: name, wrapper-contract: principal }
- Your systems store this mapping and are able to resolve that I own hank.btc
It’s possible for a wrapped name to be transferred. In that case, your app should resolve the owner of a name to the current owner of the wrapped BNS X name.
- Example: I mint hank.btc, and then transfer it to Alice. If you lookup the owner of the “wrapped” hank.btc, you’ll show Alice as the owner.
Primary names are a mechanism to keep the ‘one-name-one-owner’ behavior that allows apps to show a single name for a STX address. In our protocol, if anyone owns a BNS X name, they’ll have a primary name stored on-chain. Users don’t have to set this manually, although they can change their primary name if they own multiple BNS X names.
I’m an app: What do I need to do to resolve BNS X names?
On day one, we’ll provide an API endpoint that mimick the Stacks Blockchain API BNS endpoints 1-for-1. For BNS-related API calls, you’ll only need to update your app to query our URL for those endpoints.
We will extend the current API interface to also include BNS X-specific data, like a user’s primary name and the NFT’s integer ID.
Examples:
- I own hank.btc, and I’ve wrapped it
-
/v1/names/hank.btc
will return me as the owner, not the wrapper. -
/v1/addresses/stacks/SP123...
will returnhank.btc
as the name.- If will also return other names if I own multiple wrapped names.
-
- Alice owns
alice.btc
, and it’s not wrapped- The API endpoints described above will resolve exactly as they do today.
I’m an NFT wallet or marketplace: What do I need to do to list BNS X names properly?
If you support SIP9 NFTs: Nothing. You are all set.
I’m the Hiro API: What can I do to help?
We are aiming to work together with Hiro and the community to get BNS X name resolution included by default in the Stacks Blockchain API repo. With that change, apps that use that API for BNS info won’t have to do anything to allow users to resolve their names properly.