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

ENS Integration workshop @ #ETHBerlin

1eecfce54b4f902784d046328935efd4?s=47 Makoto Inoue
September 08, 2018
31

ENS Integration workshop @ #ETHBerlin

1eecfce54b4f902784d046328935efd4?s=128

Makoto Inoue

September 08, 2018
Tweet

Transcript

  1. Ethereum Name Service https://ens.domains #ETHBerlin

  2. Speakers @makoto_inoue @DeanEigenmann @_jefflau @aliazam2251

  3. 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)
  4. Intro: What is ENS?

  5. What is ENS? 0xfdb33f8ac7ce72d7d4795dd 8610e323b4c122fbb

  6. What is ENS? arachnid.eth

  7. What is ENS? arachnid.eth

  8. What is ENS? arachnid.eth

  9. 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
  10. More than just .eth

  11. More than just .eth

  12. What can you do with your ENS?

  13. 1. Name your address (aka lookup)

  14. 2. Show names (aka reverse lookup)

  15. Custom swags?

  16. 3. Give subdomain

  17. ENS contract and API overview

  18. ENS Architecture

  19. Resolving a name

  20. Contract MyResolver { address me; function MyResolver() { me =

    msg.sender; } function addr(bytes32 node) constant returns (address) { return me; } } ENS by example: Resolvers
  21. Using ENS from Javascript import ENS from `ethereum-ens’ const ens

    = new ENS(web3);
  22. Looking up names const address = await ens.resolver(‘arachnid.eth’).addr();

  23. Reverse resolution const addr = ‘0x112234455...’ const name = await

    ens.reverse(‘0x112234455...’).name() //for security const addr2 = await ens.resolver(name) if(addr === addr2){ …. }
  24. Setting up reverse resolution reverseRegistrar.setName(‘jefflau.eth’)

  25. Contracts in web3 var testContract = web3.eth.contract( [{"constant":true,"inputs":...}]) var test

    = testContract.at(“0x0904dac3347ea47d208f...”);
  26. Contracts in ENS const contract = ens.resolver(‘arachnid.eth’).instance(); contract.myContractMethod()

  27. Issuing subdomain to new users for your dapp

  28. Zinc signup flow Make sure - User is on the

    right network - Metamask is unlocked
  29. 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!
  30. Sign up Subdomain transactions are sent asynchronously so users can

    start using the platform instantly
  31. Verify account Signing a message to verify they hold the

    account A nounce to prevent replay attacks
  32. 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.
  33. 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) }
  34. ENS Workshop & Hackathon Retrospective

  35. 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
  36. 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?
  37. 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/
  38. Hackathon https://github.com/ensdomains/hack2018/issues

  39. Hackathon Winner (ensnifty.com) https://medium.com/the-ethereum-name-service/ens-hackathon-winners-interview-1st-place-23fcead92afd

  40. Runner ups (firefly ENS integration) https://medium.com/the-ethereum-name-service/ens-hackathon-winners-interview-2nd-place-79d7831e2212

  41. Runner ups ( ENS address books) https://medium.com/the-ethereum-name-service/hackathon-winners-interview-the-joint-3nd-place-ens-girls-17693090195a

  42. https://medium.com/the-ethereum-name-service https://docs.ens.domains/en/latest http://github.com/ensdomains References

  43. Questions?