How to: Mint Subdomains Using Smart Contracts Guide

How to: Mint Subdomains Using Smart Contracts Guide

This guide covers how to mint UD subdomains using proxy contracts. This process requires using the Polygonscan user interface to write and execute proxy contracts.

INFO

Subdomains can only be minted for Polygon-based (L2) domains. Ethereum and Zilliqa domains will need to be migrated to Polygon before they can mint subdomains.

Step 1: Select a Minting Manager Smart Contract

The Minting Manager smart contract is an interface for minting second-level domains. Choose one of the Minting Manager smart contracts to interact with (either Polygon mainnet or testnet).

polygon minting manager contract

polygon minting manager contract

Step 2: Open the "Write as Proxy" Tab for the Minting Manager

Navigate to the Contract tab in the Polygonscan page of the Minting Manager contract and click on the Write as Proxy tab:

polygonscan write as proxy tab

polygonscan write as proxy tab

Step 3: Connect Your Web3 Wallet

Click on the Connect to Web3 button in the Write as Proxy tab and connect the wallet associated with the domain:

polygonscan connect wallet

polygonscan connect wallet

 

wallet provider list

wallet provider list

Step 4: Mint the Subdomain

Choose the issueWithRecords() method from the Write as Proxy tab section. The method allows you to mint subdomains of domains you already own to your wallet address.

polygonscan issueWithRecords method

polygonscan issueWithRecords method

Next, add your wallet address that owns the root domain to the to field and the subdomain you want to mint to the labels field. For example, if you own the example.crypto domain with your wallet address as 0xC37d3c4326ab0E1D2b9D8b916bBdf5715f780fcF and you want to mint blog.example.crypto, you will fill the parameters like so:

filling issueWithRecords parameters

filling issueWithRecords parameters

Then, add the record(s) you want pre-filled in the subdomain after minting to the keys and values fields as an array of values. See the Records Reference documentation for supported values. You can also provide empty records if you wish to. Set parameter withReverse to false if you do not need to set reverse record for the subdomain. It is possible to set reverse record for subdomain only if it is going to be minted to parent's domain owner, otherwise setting reverse is considered insecure without subdomain owner's signature.

filling issueWithRecords parameters

filling issueWithRecords parameters
INFO

Domain records aren't automatically pre-filled in subdomains unless specified during minting. If you do not provide any records when minting a subdomain, you can always add/update them at a later time.

Step 5: Execute the Contract

Click the Write button to sign the transaction and execute the contract. After signing the transaction, you can view its details on the blockchain explorer, like so:

polygonscan transaction details

polygonscan transaction details

Considerations

The following considerations apply to minting subdomains:

  • Subdomains must contain only lowercase letters ( a-z ), numbers ( 0-9 ), and hyphens ( - )
  • Subdomain names cannot start with a hyphen ( - )

CONGRATULATIONS!

You have successfully minted a subdomain using smart contracts. Happy hacking!

Post a Comment

0 Comments