Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ENS Integration workshop @ #ETHBerlin

Makoto Inoue
September 08, 2018
43

ENS Integration workshop @ #ETHBerlin

Makoto Inoue

September 08, 2018
Tweet

Transcript

  1. Agenda - 1. Intro & What can you do with

    ENS? - 2. ENS contracts and API overview - 3. Issuing subdomain to new users for your dapp - 4. Summary of ENS workshop (9-11 Aug)
  2. More than just names ENS names contracts and accounts, but

    also… • Swarm & IPFS records • Legacy DNS records - IP addresses, mail exchangers • Identity attestation • Stores contract interfaces
  3. Contract MyResolver { address me; function MyResolver() { me =

    msg.sender; } function addr(bytes32 node) constant returns (address) { return me; } } ENS by example: Resolvers
  4. Reverse resolution const addr = ‘0x112234455...’ const name = await

    ens.reverse(‘0x112234455...’).name() //for security const addr2 = await ens.resolver(name) if(addr === addr2){ …. }
  5. Zinc signup flow Make sure - User is on the

    right network - Metamask is unlocked
  6. Getting ENS subdomain Check if the ENS subdomain already exists

    - If yes, then check if it is owned by the address currently on metamask - If yes then its a sign in, make them sign a message to prove they actually hold the acount they are signing up for. If it doesnt exist then they can have it!
  7. Verify account Signing a message to verify they hold the

    account A nounce to prevent replay attacks
  8. Account Users are logged in regardless of the status of

    transactions. (UX comment) Since Zinc sends the transactions and the messages are verified on chain, they are also verified off chain to prevent sending transactions which are guaranteed to fail.
  9. The code const prepSub = nameprep(sub) const prepDomain = nameprep(domain)

    const setSubnodeOwner = setSubnodeOwnerTx( prepSub, prepDomain, ZINC_ETH_ADDRESS ) const setResolver = setResolverTx(prepSub, prepDomain) const setAddr = setAddrTx(prepSub, prepDomain, address) const setSubnodeOwnerToUser = setSubnodeOwnerTx( prepSub, prepDomain, ownerAddress ) const setSubnodeOwnerTx = (....){ const node = namehash.hash(domain) const label = web3.utils.sha3(sub) const txData = { nonce: web3.utils.toHex(transactionNonce), gasLimit: web3.utils.toHex(DEFAULT_GAS_LIMIT), gasPrice: web3.utils.toHex(getGasPrice()), to: ENS_REGISTRY_ADDRESS, from: ZINC_ETH_ADDRESS, data: ensRegistry.methods .setSubnodeOwner(node, label, ownerAdress) .encodeABI() } return signTx(txData) }
  10. ENS as an entry point into blockchain - Onboarding users

    - Forwarding them to various dApps - Every dApp should be an entry point! - dApps should give users subdomains
  11. ENS Governance - Blacklists - We can only block not

    take control of - Social Consensus bro! - Needs a dispute resolution system - Allow users to choose blacklists - How do we keep arbitrators honest? - Set of guidelines, what is an infringement?
  12. Registrar and Rent - Auctions suck - We need an

    instant process with rent - Users should be able to prefund domains - $10-$30 - Prices can’t vary too much - https://discuss.ens.domains/