Goerli - Unwrapping From Old Name Wrapper

If you had wrapped your name on the Goerli testnet in a previous test deployment of the Name Wrapper, then the v3 alpha manager UI will not allow you to unwrap it. Instead, you will need to unwrap it manually via contract. Hopefully this guide will help.

Also see this thread for additional context on the Name Wrapper: NameWrapper updates (including testnet deployment addresses)

1. Determine Wrapper Contract

Look at your name on https://alpha.ens.domains/. If it was wrapped with an older version of the Name Wrapper, then both the manager and owner will be set to that address.

For example, 0x23d86f0bf4900978B191378B134519371Da52f75 is an old (3/3/23) deployment of the wrapper.


Primary Method - Calling Upgrade

The Goerli testnet Name Wrapper deployments use a dummy “upgrade contract” that simply unwraps any name. This will work even if your name is Locked (in other words, if you have revoked the permission to unwrap the name).

However, this method will only work if the Name Wrapper contract actually has the upgrade contract set. As of this writing, the Name Wrapper from 3/3/23 (0x23d86f0bf4900978B191378B134519371Da52f75) does not have one set, so you will not be able to use this method with that contract. See the Alternate Method - Calling Unwrap section below instead.

2. Calculate parent nodehash / name bytes

Different deployments of the Name Wrapper have different upgrade methods. Depending on which one your name is wrapped in, you may need the parent nodehash. If you’re not sure what this is, see here.

Go here: https://npm.runkit.com/

2a. Using the 31/1/23 or earlier contract

If you are unwrapping a .eth 2LD, then you don’t need to calculate anything. Go to Step #3 - Call Upgrade.

If you are unwrapping any other name / subname, then you will need to calculate the parent nodehash.

If your name is sub.myname.eth, then calculate the nodehash for the parent myname.eth.
If your name is mydomain.com, then calculate the nodehash for the parent com.

Run this code (replace myname.eth as needed):

require('@ensdomains/eth-ens-namehash').hash('myname.eth')

image

2b. Using the 3/3/23 or newer contract

If your name is wrapped in the contract from 3/3/23 or newer, then you will need to calculate the DNS-encoded bytes for your name.

Run this code to get the DNS-encoded version of your name (replace myname.eth as needed):

'0x' + require('dns-packet').name.encode('myname.eth').toString('hex');


3. Call Upgrade

As long as the contract is verified on Etherscan, then you can invoke methods there directly.

Go to https://goerli.etherscan.io/ and enter the address of the Name Wrapper contract you originally wrapped in (from Step #1).

Go to the Contract tab → Write Contract. Click on “Connect To Web3” to connect your wallet.

3a. Using the 31/1/23 or earlier contract

In this case, there are two separate methods: upgrade and upgradeETH2LD.

If you are unwrapping a .eth 2LD, then expand the upgradeETH2LD method, and fill in the parameters:

  • label: Your name, minus the .eth.
  • wrappedOwner: The owner of the .eth name / NFT. Enter your address.
  • resolver: Currently unused by the dummy upgrade contract. You can just enter 0x0000000000000000000000000000000000000000.

image

If you are unwrapping any other name, then expand the upgrade method, and fill in the parameters:

  • parentNode: The parent nodehash you created from Step #2.
  • label: Your name, only up to the first period (.).
    • Example: label of sub.myname.eth is sub
    • Example: label of mydomain.com is mydomain
  • wrappedOwner: The owner of the .eth name / NFT. Enter your address.
  • resolver: Currently unused by the dummy upgrade contract. You can just enter 0x0000000000000000000000000000000000000000.

image

3b. Using the 3/3/23 or newer contract

In this case, there is just a single upgrade method. Expand that method, and fill in the parameters:

  • name: The DNS-encoded version of your name that you created in Step #2.
  • extraData: Currently unused by the dummy upgrade contract. You can just enter 0x.

image

3c. Execute the transaction

Click “Write” to send the transaction to your wallet.

After the transaction is confirmed, then your name will be unwrapped again, and you can rewrap it in the new version of the Name Wrapper if you wish.




Alternate Method - Calling Unwrap

Use this method if the Name Wrapper contract does not have an upgrade contract set. As of this writing, the Name Wrapper from 3/3/23 (0x23d86f0bf4900978B191378B134519371Da52f75) does not have one set, so you will need to use this method instead.

Note that you will only be able to use this method if your name is not Locked (in order words, if you have not revoked the permission to unwrap the name).

2. Calculate node/labelhash

If you are unwrapping a .eth 2LD (second-level domain), you will need just the labelhash. Otherwise, you will need both the parent nodehash, and the labelhash. If you’re not sure what these are, see here.

Go here: https://npm.runkit.com/

2a. Unwrapping a .eth 2LD

If your name is myname.eth, then calculate the labelhash for myname.

Run this code to get the labelhash (replace myname as needed):

'0x' + require('js-sha3').keccak_256('myname')

image

2b. Unwrapping any other name / subname

Parent Nodehash

If your name is sub.myname.eth, then calculate the nodehash for the parent myname.eth.
If your name is mydomain.com, then calculate the nodehash for the parent com.

Run this code (replace myname.eth as needed):

require('@ensdomains/eth-ens-namehash').hash('myname.eth')

image

Labelhash

If your name is sub.myname.eth, then calculate the labelhash for sub.
If your name is mydomain.com, then calculate the labelhash for mydomain.

Run this code (replace sub as needed):

'0x' + require('js-sha3').keccak_256('sub')

image


3. Call Unwrap Method

As long as the contract is verified on Etherscan, then you can invoke methods there directly.

Go to https://goerli.etherscan.io/ and enter the address of the Name Wrapper contract you originally wrapped in (from Step #1).

Go to the Contract tab → Write Contract. Click on “Connect To Web3” to connect your wallet.

Then, invoke either unwrapETH2LD or unwrap, depending on whether you’re unwrapping a .eth 2LD or not.

3a. Unwrapping a .eth 2LD

Expand the unwrapETH2LD method, and fill in the parameters:

  • labelhash: The labelhash you created from Step #2.
  • registrant: The owner of the .eth name / NFT. Enter your address.
  • controller: The manager of the name. Enter your address.

image

Click “Write” to send the transaction to your wallet.

After the transaction is confirmed, then your name will be unwrapped again, and you can rewrap it in the new version of the Name Wrapper if you wish.

3b. Unwrapping any other name / subname

Expand the unwrap method, and fill in the parameters:

  • parentNode: The parent nodehash you created from Step #2.
  • labelhash: The labelhash you created from Step #2.
  • controller: The manager of the name. Enter your address.

image

Click “Write” to send the transaction to your wallet.

After the transaction is confirmed, then your name will be unwrapped again, and you can rewrap it in the new version of the Name Wrapper if you wish.

5 Likes

Wow very useful!

1 Like

According to @jefflau.eth and I also try myself, calling upgradeETH2LD in the old namewrapper also works for unwrapping the 2LD an wrap to new one, even with can_unwrap burnt! :partying_face:

1 Like

Great! Yep that’ll work too, as long as there is an upgrade contract set.

The Name Wrapper deployment from 2 revisions ago (31/1/23, 0x060f1546642E67c485D56248201feA2f9AB1803C) does have one set.

However, the previous deployment (3/3/23, 0x23d86f0bf4900978B191378B134519371Da52f75) does not have one set, so the upgrade method won’t work for that one currently.

Older revisions have separate upgrade and upgradeETH2LD methods, and they take in the parent nodehash and/or plaintext label.

Newer revisions only have a single upgrade method used for all names. However they are a bit more of a pain for the average joe to call on Etherscan because they need to know how to DNS encode the full name string into bytes first.

I tried to unwrap planetable.eth in this old contract:

0x582224b8d4534F4749EFA4f22eF7241E0C56D4B8

So I used RunKit to calculate ParentNode and LabelHash:

ParentNode

require('@ensdomains/eth-ens-namehash').hash('planetable.eth')

Returns:

0x7b26d27abaced593c582148f2eb315e57ff6bf40bbf81da5326b3055c395a7bd

LabelHash

'0x' + require('js-sha3').keccak_256('planetable')

Returns:

0x69c74bf290166138314c97ff73b24e25699f42128e0728fdf0f78b6a3a7bb819

And the transaction failed with those values.

https://goerli.etherscan.io/tx/0xa2b740d3024f6a3e61d49003d843669e30dfdb9afc2db75ccdf4e68003f37966

Looks like you are calling unwrap(), but you need to be calling unwrapETH2LD().

If you have CANNOT_UNWRAP burnt you can unwrap using julie’s method by calling upgradeETH2LD()

Thank you so much! It’s a success!

https://goerli.etherscan.io/tx/0xe2cbcc0d21d7d0b2def858578f7f97a4afb66d5241ad5a38da48f6751135c8fb

FYI I updated the guide with instructions on using the upgrade methods. That would be the preferred way to do it if you can, because it’ll work even with Locked names!

Right now the upgrade methods won’t work with the 3/3/23 (0x23d86f0bf4900978B191378B134519371Da52f75) contract.

An example about how to update codebase after namewrapper updtae
I wrote this note about how to update my project codebase based on namewrapper update. Hope this will help new developer to update their codebase too:

2 Likes