🚀Core - Full Integration
Learn how to integrate our full core library for interacting with our Smart Contracts
Last updated
Learn how to integrate our full core library for interacting with our Smart Contracts
Last updated
Our Core Library allows developers to integrate fully with Decentraweb and interact with our Smart Contracts, providing tools for :
Reading and Setting Decentraweb Domain Records
Reading and Setting DNS & Text Records for Decentraweb Domains
Registering Web3 Domains (absolutely.anything) and Web3 Subdomains (wow.absolutely.anything)
Our Core Library is perfect for developers looking to provide or sell Web3 Domain registrations, as well as allowing management of Web3 Domains all within their own platform, Website or dApp
Our Core Library contains Decentraweb's latest ABIs and can be used directly or embedded in other projects such as the Decentraweb Resolver and CLI.
View our NPM Package :
View our Advanced Docs :
To install Decentraweb Core Library, run the following within your terminal to your project directory
Initialize Decentraweb instance to read/write domain records :
Parameters:
network
(required) - Ethereum network name (mainnet
, goerli
, matic
, maticmum
)
provider
(required) - ethers Provider instance to read blockchain data.
signer
(optional) - ethers Signer instance. Only required if you want to write data to blockchain.
contracts
(optional) - used to override default Decentraweb contract addresses. Only needs to be used for development purposes.
This library is using ethers.js to interact with Ethereum blockchain. ethers.js
is included as peer dependency, so don't forget to add it to your package.json
In most cases importing library using npm
is preferred way, but for fast prototyping you can load it from our CDN :
Decentraweb Web3 Domains can be registered on Ethereum or Polygon Networks, depending on which network the associated TLD exists within. Owners of Web3 Domains, and yourself as a Web3 TLD owner, can opt to bridge all levels of Decentraweb Domains, Ethereum -> Polygon or Polygon -> Ethereum, at any time by using our Domains Bridge (Read Guide)
To provide Web3 Domain Registrations (e.g absolutely.anything) from your Web3 TLD(s) (e.g .anything) on your own platform, website or dApp, please ensure that you have registered and staked your Web3 TLD(s) within our DNS Platform
To initialize allowing Web3 Domain Registrations from your TLD within your dApp :
Domain names support following types of records:
Wallet Addresses
Content hash
Text records
DNS records
Domains on the Ethereum network supports all types of records, while domains on the Polygon network support only Wallet Addresses at this moment.
A valid signer instance must be provided to enable writing data to blockchain.
All write operations return instance of ethers.js TransactionResponse class. You can call transaction.wait(n)
to wait until transaction get n
confirmations.
Decentraweb domain supports setting wallet addresses for multiple cryptocurrencies. Decentraweb is compatible with ENS (EIP-2304) and uses @ensdomains/address-encoder package to encode/decode wallet addresses.
Full list of supported cryptocurrencies can be found in @ensdomains/address-encoder documentation.
Get Wallet Address
Set Wallet Address
Reverse Resolution
Reverse address resolution is only possible for Ethereum wallets.
To allow reverse resolution for Wallet Address -> Decentraweb Domain :
This will set name "wow.greatdomain" for the wallet address that was used to sign the transaction.
To resolve Ethereum address to name use following method:
By default getReverseRecord
also performing forward check. This mean that after finding name by address, it will also check that found name is owned by given address. To resolve address without this check, pass true
as second argument:
DNS records are stored in binary format known as DNS Wireformat. This library utilize dns-packet package to encode/decode DNS data. This library exports RecordSet
utility class to help with encoding/decoding.
Decentraweb domains support storing content hash. This feature is following ENS EIP-1577 standard. Supported content hash URL formats:
Text records allow domain owner to store simple key-value string data in domain. To remove text record simply set it to empty string.
This concludes our guide on installing our Core Library. If you should have any questions or need assistance, please reach out to our integrations team - integrations@decentraweb.org