2

The secret phrase is used to encrypt a bid, and then to decrypt it. What type of encryption and decryption is used?

1

One of the ENS folks will probably want to confirm, but from poking around at the code in the official ens-registrar-dapp repository, in newBid.js, it looks like a salted call to sha3().

let secret = web3.sha3(LocalStore.get('mastersalt')+name);

Where the mastersalt salt has previously been created in the following way:

if (LocalStore && !LocalStore.get('mastersalt')) {
    if (window.crypto && window.crypto.getRandomValues) {
        random = window.crypto.getRandomValues(new Uint32Array(2)).join('')
    } else {
        random = Math.floor(Math.random()*Math.pow(2,55)).toString();
    }
    LocalStore.set('mastersalt', Daefen(random));
} 

The secret, along with other parameters, is then passed to bidFactory to create a bid object, which can then be submitted.

myBid = registrar.bidFactory(
  name,
  web3.eth.accounts[0],
  web3.toWei(2, 'ether'),
  secret
);

During the reveal phase, the work is done by unsealBid().

There's not actually any decryption going on here. What happens is that you pass the same parameters as you did when the bid was created, and the two bid objects are matched.

During the reveal period of the auction, you must submit the parameters of a bid. The registrar contract will generate the bid string, and associate the bid parameters with the previously submitted bid string and deposit.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.