Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to recover a bid on ENS if you still have the master salt

How to recover a lost a ENS bid if you still have the secret

  1. Download your bid backup and open it in a text editor. You can paste the code on a service like this to make it more readable: https://jsonformatter.curiousconcept.com

  2. Search for the name of your bid to check it's not there. If it's not then at the top of your file you'll find something like this:

{
   "About":{
      "backupDate":"2017-06-17T15:34:23.014Z",
      "mastersalt":"Oompa Loompa Doo"
   },
   "MyBids":[
      {
         "_id":"W43yyoydBPLW7w2Lx",
         "date":1497625514274,
         "mastersalt":"Oompa Loompa Doo",
         "depositAmount":"1000000000000000000",
         "name":"name-that-i-want",
         "hash":"0xxxxxxx",
         "value":"1000000000000000000",
         "owner":"0xxxxxxxx",
         "secret":"b6ccb98688436465ab149bcf2efa794669c81195b9eda34dcfe4447a384d06f8",
         "hexSecret":"0x5b2815e400e3c8c99354cc337daf9acbc83612077fd36fbc7b1e9e5462055fc6",
         "shaBid":"0x204585248a2501796682aafdaa9903b9f27b63ebd61d72002cdf7f4894eb73f1"
      },
  1. Search for all instances of "mastersalt" and see if they are all the same. If they are not, you need to repeat this step with all of them. If you have no "mastersalt" set, then you probably won't be able to recover

  2. Duplicate the last item between the last { and }, and modify it to your details:

  • _id can be any random string
  • date and mastersalt leave it untouched
  • value the amount you bid, ignoring any extra amount set, in wei.To convert ether to wei, use this handy tool. You must remember this.
  • depositAmount the total amount you deposited, ignoring any extra amount set, in wei. To convert ether to wei, use this handy tool. If you don't remember this, use the same as value
  • owner the public address you used to send the transaction. You must know this.
  • hash use this keccak-256 tool and use the name you want (lowercase, no .eth) as input. Add 0x to the beginning of the value it outputs if it doesn't start with one.
  • secret take your mastersalt, plus the name you want and put it through keccak-256 tool. In the above example it would be "Oompa Loompa Dooname-that-i-want"
  • hexSecret take the secret, put it through keccak-256 again and add a "0x" at the beginning.
  • shaBid open ENS registar on etherscan tab, "read contract" and find the "shaBid" function. Add the values of hash, owner, and value. Use the "hexSecret" you obtained as the salt.
  1. On the same page as etherscan, use the "sealedBids" function and use the "owner" and the "shaBid" you just got from the step above. If the result is an address then bingo, you found the combination. If it's 0x000.. then you either have the wrong details, or that bid has been revealed already

  2. Once you found it (use the other bids on your json file to check you did everything correctly!) then add that bid to your list, save it and import on your registrar dapp. The reveal button should appear. If that doesn't work, you can also use https://www.myetherwallet.com/ens tool and use hexSecret as the secret.

Good luck!

@nrhirsch

This comment has been minimized.

Copy link

nrhirsch commented Jun 30, 2017

Taking the above, I did it a little differently step by step. Note if you have different mastersalts, trying each one after the first one is easy since there is only one field (line 2 (salt=hexsecret) that you need to change in the form:
https://etherscan.io/address/0x6090a6e47849629b7245dfa1ca21d94cd15878ef#readContract

Here are the steps the way I would do it. It worked for me! Had to try numerous mastersalts before I found the one that worked:

  1. owner name/address here:

  2. name you want here

  3. put name into https://emn178.github.io/online-tools/keccak_256.html and add 0x in front and copy in line 4 below

  4. here is the hash of the name you want. It will be used in step 14 below under hash

  5. amount you bid in ether here and enter that amount in ether line of: https://www.myetherwallet.com/helpers.html then copy the number at the top put in 6 below

  6. this is the value AND depositAMOUNT generally in wei. It will be used in step 14 under value

  7. mastersalt here

  8. mastersaltname you want here (just append the name to your mastersalt without any space and in lowercase)

  9. https://emn178.github.io/online-tools/keccak_256.html of step 8 here and put 0x in front and paste to line 10

  10. this is the secret

  11. put step 10 in https://emn178.github.io/online-tools/keccak_256.html and again add 0x and paste it in line 12

  12. this is your "hexsecret" it will be used as "salt" in line 14 below

  13. go to: https://etherscan.io/address/0x6090a6e47849629b7245dfa1ca21d94cd15878ef#readContract

  14. note line 2. shaBid hash (bytes32), owner (address), value (uint256), salt (bytes32) Query

  15. put hash from line 4, owner from line 1, value from line 6, salt (hexsecret) from line 12 and push Query copy result created under modify to line 16

  16. this is your shabid

  17. now look at line 5. sealedBids (address), (bytes32) Query

  18. put owner name in first input address and put shabid in second input and press Query

  19. look at result. if an address, then you're good. If 0x00000.... try another mastersalt. leave the page as it is and only change the one thing "hexsecret"

  20. to do another mastersalt, just do step 7-12 above then put the result of 12 in the salt, press query to get the shabid and input that again into line t and see if it's and address or 0x000.

  21. continue until you get an address. if you get an address create a JSON bid using template below and append it to your existing JSON bid.

    {
    "_id":"W43yyoydBPLW7w2Lx", <random. change a character to assure unique>
    "date":1497625514274,
    "mastersalt":"from line 7",
    "depositAmount":"from line 6",
    "name":"from line 2",
    "hash":"from line 4",
    "value":"from line 6",
    "owner":"from line 1",
    "secret":"from line 10",
    "hexSecret":"from line 12",
    "shaBid":"from line 16"
    },

The above may or may not work to give you a successful reveal in register.ens.domains. If it fails during reveal period, go over to https://www.myetherwallet.com/#ens and use the hexsecret from line 12 above as the "secret phrase" instead of the three words suggested.

@nrhirsch

This comment has been minimized.

Copy link

nrhirsch commented Jul 6, 2017

Importing a bid created in MEW into ENS and vice versa
The fields of MEW and ENS appear to be different but in fact they have different names and styles for the same thing.
Here is a comparison of the two JSON files and how they compare to each other:

BELOW IS A MEW JSON FILE (push enter, ie. add a line after each “,” to get it to look like this) :

“name”:same as name in ENS,
“nameSHA3”:”0x + keccak-256 of name”, same as “hash” in ENS=identical bud different labels
“owner”:same as owner in ENS, identical
“value”:same as name in ENS, identical
“secret”: same as secret in ENS, identical
“secretSHA3”: 0x + keccak-256 of “secret above”, same as hexSecret in ENS, identical but different label

BELOW IS AN ENS JSON FILE (push enter, ie. add a line after each “,” to get it to look like this) :

“_id”: unique to ENS, pick one from an existing ENS JSON file and modify it a bit
“date”: unique to ENS, pick one from and existing ENS JSON file and modify it a bit.
“mastersalt”: unique to ENS, remove this line.
“depositAmount”: unique to ENS, use same as value below,
“name”: same as name in MEW,
“hash”: “0x + keccak-256 of name”, identical label in MEW
“value”: same as value in MEW, identical label in MEW
“owner”: same as owner in MEW, identical label in MEW
“secret”: same as 3 word secret in MEW, 0x + keccak-256 of mastersalt+name
“hexSecret”: same as secretSHA3 in MEW, 0x + keccak-256 of secret above
“shaBid”: unique to ENS, calculate using Method Response of Line 2 in ReadContract: https://etherscan.io/address/0x6090a6e47849629b7245dfa1ca21d94cd15878ef#readContract
“revealed”: unique to ENS,
“revealing”: unique to ENS

note: spaces after : in ENS, no space after “ in MEW

The only thing you need to “calculate” is the shaBid field which is calculated and checked as being valid by using Alex Vandesande’s explanation above.

@meta27

This comment has been minimized.

Copy link

meta27 commented Jul 6, 2017

Thank you so mucho for your great help

@nrhirsch

This comment has been minimized.

Copy link

nrhirsch commented Jul 16, 2017

imToken:
with imToken, the app for smartphones by ConsenLabs co, ltd, it’s also easy to create bids there and import bids created there into ENS. First you must import your wallet which I did using the Metamask mnemonic (can also use private key or keystore). You can import your existing bids by copy and pasting the JSON file into the import window.
Bid creation: In the case of imToken, you create your own secret by typing it in the imToken app. so your inputs are simply, name.eth, the secret you create and the Bid amount in ETH (haven’t tried disguise amount also available). If you do a keccak-256 of the secret, and then add 0x in front, you’ll have your hexsecret. You can convert your ETH to wei in order and keccak-256 the name to hash to transfer the bid to registrar.ens.domains but you don’t need to do that if you have registrar.ens.domains do it for you by starting, downloading but rejecting the bid. Start the same bid in registrar.ens.domains with same amount and name and download the bids. Download the bid BEFORE you then REJECT the bid in Metamask. You will have the information in a pending are of the JSON file that you will modify and move up to the bid section. You won’t lose any gwei and no ETH will be subtraced from your wallet if you REJECT. Looking at the JSON file you’ll have almost all the information necessary to finish replicating/creating your bid. You can use the id (move it to the top for consistency), date, name, hash, value, and owner found in the bottom pending bids area of the JSON file, substitute the secret (from imToken), hexsecret (keccak-256 of secret). You don’t need to include revealed, or revealing or shabid lines. They will all be automagically added after you move the lines from the pending area up to the bid area in the JSON file and import that file. The shabid can be calculated and added if you wish by using Alex’s method on the read contract link. It will match what registrar.ens.domains calculates and adds to the JSON file for that bid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.