{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-web3/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"On-chain Buy","description":"The developer documentation portal and API reference for Unstoppable Domains.","siteUrl":"https://docs.unstoppabledomains.com","keywords":"unstoppable domains developer portal, api reference docs","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"on-chain-buy","__idx":0},"children":["On-chain Buy"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Registry API expands the domain registration options by offering a direct-to-blockchain mothod for registering domains. The API is ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://docs.unstoppabledomains.com/apis/registry/#tag/domains"},"children":["publically available"]}," and retrieves both domain pricing and pre-approval for purchase which are sent to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Buy"]}," function on the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://polygonscan.com/address/0x7be83293BeeDc9Eba1bd76c66A65F10F3efaeC26#writeProxyContract"},"children":["smart contract"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"check-domain-availability","__idx":1},"children":["Check Domain Availability"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Registry API provides a ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://docs.unstoppabledomains.com/apis/registry/#operation/GetDomain"},"children":["domain availability endpoint"]}," for checking registration status of a domain name."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To use this endpoint, you will need to include the domain name of interest and one of our ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://docs.unstoppabledomains.com/apis/resolution/#operation/StatusController.listSupportedTlds"},"children":["supported domain endings"]}," as part of the API query. For example, checking the availability of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["qwerty.wallet"]}," would look like this:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const data = fetch(`https://api.unstoppabledomains.com/registry/v1/domains/qwerty.wallet`, {\n  method: \"GET\",\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Which would yield the below JSON response."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"name\": \"qwerty.wallet\",\n    \"availability\": {\n        \"status\": \"AVAILABLE\",\n        \"price\": {\n            \"listPrice\": {\n                \"usdCents\": 75000\n            },\n            \"subTotal\": {\n                \"usdCents\": 75000\n            }\n        }\n    }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"request-purchase-transaction-details","__idx":2},"children":["Request Purchase Transaction Details"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once you have confirmed the domain is available, you can request the transaction details for purchasing the domain and minting it to a specific wallet address."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Continuing with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["qwerty.wallet"]}," example, make a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," request to the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://docs.unstoppabledomains.com/apis/registry/#operation/PostDomainPurchaseParameters"},"children":["purchase parameters endpoint"]}," with a payload indicating the claiming wallet address, any crypto records that should be set on mint, as well as the currency the domain will be purchased in."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An example payload would be:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"owner\": { \n      \"address\": \"0x1234567890123456789012345678901234567890\" \n    },\n    \"records\": {\n      \"crypto.ETH.address\": \"0x6EC0DEeD30605Bcd19342f3c30201DB263291589\",\n      \"crypto.BTC.address\": \"bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh\"\n    },\n    \"currency\": \"MATIC\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Currently ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MATIC"]}," is the only supported currency."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You will get JSON response that confirms the domain availability and pricing, as well as the encoded transaction details such as:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n...\n\"params\": {\n            \"to\": \"0x7be83293BeeDc9Eba1bd76c66A65F10F3efaeC26\",\n            \"data\": \"0xd7db74c7000000000000000000000000ee72f1035c706478f84ab9480e45b427aa6b668200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000006583051a0000000000000000000000000000000000000000000000342006d851f399d89d000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000067177657274790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000677616c6c65740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041470820c63403b51b4be6bbb30af2b00aa977f674c13b4c0a7c35f2be351e9b026585e1b337d7ca916f2d0650493bcd4e3ba804ee34e10e8c9fee7448288c84921b00000000000000000000000000000000000000000000000000000000000000\",\n            \"value\": \"0x342006d851f399d89d\"\n        }\n}\n\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"send-transaction","__idx":3},"children":["Send Transaction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["With the above transaction details, you are now able to use your Web3 library of choice to send the transaction. Using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ethers"]}," as an example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const provider = new ethers.providers.Web3Provider(library.provider);\nconst params = {\n  to: txParams.to,\n  data: txParams.data,\n  value: txParams.value,\n};\n\nconst signer = provider.getSigner();\nawait signer.sendTransaction(params);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The specified owner will recieve the domain as a result of a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["successful"]}," transaction."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["That's it! You are now able to purchase Unstoppable domains on chain."]}]},"headings":[{"value":"On-chain Buy","id":"on-chain-buy","depth":1},{"value":"Check Domain Availability","id":"check-domain-availability","depth":2},{"value":"Request Purchase Transaction Details","id":"request-purchase-transaction-details","depth":2},{"value":"Send Transaction","id":"send-transaction","depth":3}],"frontmatter":{"title":"On-chain Purchases with the Registry API | Unstoppable Domains Developer Portal","description":"How to purchase Unstoppable domains using the Unstoppable Domains Registry API and Smart Contract","seo":{"title":"On-chain Buy"}},"editPage":{"to":"https://github.com/unstoppabledomains/dev-docs/blob/main/web3/domain-distribution-and-management/guides/on-chain-buy.md"},"lastModified":"2026-04-10T16:45:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/web3/domain-distribution-and-management/guides/on-chain-buy","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}