Skip to content
Web3j ENS Updates feature image
Andrii Kliui

Published On - May 31, 2022

Web3j ENS Layer2 and Offchain Data Support

New significant ENS features have been added in the web3j version 4.9.2. These features are aimed at defining a universal standard of working with L2 solutions and off-chain data. 

 

  • ENSIP-10: Wildcard Resolution (EIP-2544)
  • EIP3668: CCIP Read: Secure offchain data retrieval

ENS Wildcard Resolution

Many applications have expressed a desire to issue ENS names for their users via custom subdomains on a shared parent domain. However, the cost of doing so is quite expensive for large user bases, because every single record should be set on the ENS Registry. 
 
Enabling wild card support for ENS opens the door to building more advanced resolvers that can deterministically generate addresses for unassigned subdomains and has significant implications for L2 adoption. 
 
For example web3j.eth resolves all *.web3j.eth ENS names. This means that for any given ENS name e.g my-test.web3j.eth, everything will work without any changes meaning the owner doesn't need to add anything. 
 
The good news is that you don't need to add or change anything in your code to start using this feature. There's no need to modify existing ENS Registry contracts or any existing resolvers, they will work in the same old way without any problems, with existing ENS records. Legacy ENS clients would fail to resolve wildcard records. 
 
To start using this cool feature you should just update web3j to version 4.9.2 or the latest one. 

ENS L2/Offchain integration

L2 support is one of the most significant areas of the blockchain community today which reduces gas fees and makes for much faster interactions. 
 
There are a lot of techniques for moving data off-chain, they all adopt one idea to store just a minimal amount of information to validate external data when it's required. The problem was that each application had its own solutions and own approaches. And worse still, each solution was working with some specific data storage and couldn't be easily switched to another.
 
Below I have set up a simple example to call a new functionality with this new feature. 
 

public static void main(String[] args) {
  Web3j web3j = Web3j.build(new HttpService(HTTP_MAINNET_URL));
  EnsResolver ensResolver = new EnsResolver(web3j);


  String address = ensResolver.resolve("1.offchainexample.eth");

  System.out.println(address);
}


> 0x41563129cdbbd0c5d3e1c86cf9563926b243834d

 
Have any questions or comments? We’d love to hear from you! If you want to find out more about blockchain, its growth, and newest developments, then check our dev blog or listen to our enlightening Web3 Innovators podcast.
 
Web3j