• Thursday

    • Built a name service today on polygon (mumbai). Brian Name Service: https://brian-name-service.vercel.app/
    • Wrote and deployed all solidity contracts, built/connected/deployed a client.
    • Handles multiple wallets, proper network correction, error handling, all the usuals.
    • Example transaction: https://mumbai.polygonscan.com/address/0x657132147406E0375E030987cc9d599eCd754637.
    • Example on opensea: https://testnets.opensea.io/assets/mumbai/0x6C88E92b8Be2d0B6C10Ff2b1452213D008507eFd/0.
    • A name is just an NFT, in practice.
    • Remember msg is the transaction. msg.sender, msg.value (amount sent), etc.
    • To calculate string length in solidity: https://gist.github.com/AlmostEfficient/669ac250214f30347097a1aeedcdfa12.
    • Backend keeps maps of domains to addresses, constructor defines the tld (top level domain), and functions contain some logic for pricing based on domain length.
    • And remember abi.encodePacked to convert strings into bytes so that you can combine them, measure length, etc (can’t do directly as strings).
    • Remember for the NFT; base64 encode the svg, then encode that svg and the metadata into an nft json (name, description, image, link, etc).
    • And for the 100th time: Metamask injects ‘ethereum’ into the window. You pass this to the ethers library to get a provider (node) and signer (wallet), then instantiate your contract (via address + abi) to interact with it.
    • Users can come to the react site, connect wallet, mint a new domain (I set prices in the contract, longer=cheaper), then they get an NFT to represent it.
    • This money goes to the contract. I added a function to withdraw it (for myself).
    • Defined “error” which can be passed to “revert” in repeatable ways instead of “require()” everywhere.
    • Added network checks and metamask switch network requests, since polygon/mumbai.
    • Called the contract from the frontend to fetch properties (not just call methods like previously). Can grab state, whatever data you want onchain that the contract stores.
    • Deployed on vercel. Easy with subdir frontend, even with backend sol contracts and everything in the same (small monorepo). And secrets as env vars.
    • Import point on naming systems: anybody can create them. It’s just a smart contract with a dictionary. There could be 100 “.brian” naming systems. The win is critical mass of integration. If wallets support your NS, so that they perform the lookup against YOUR contract, and not the 100 others, you’ve won. This is what the big ones have achieved (ENS, bonfida, unstoppable domains, etc).
      • The same question will occur for decentralized ISPs on web3. Where to route URL requests, domain-wise. One name system must prevail.