Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ENS and UD resolver #779

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add ENS and UD resolver #779

wants to merge 6 commits into from

Conversation

paxriel
Copy link
Contributor

@paxriel paxriel commented Aug 10, 2021

Adds capabilities to resolve ENS and Unstoppable Domains via Unstoppable Domain's Java library. The ENS resolver connects to https://cloudflare-eth.com as the default ENS resolver has rate limits on ENS domain requests.

Resolving Domain Address shown once domain name has resolved Fallback to other crypto No suitable address is found
resolving xmr btc no_addr

The app would check for OpenAlias addresses first, before using ENS and Unstoppable Domains addresses. A 1-2 second delay may be expected while waiting for the ENS and UD addresses to be resolved.

Copy link

@DancingAxolotl DancingAxolotl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a single minor change requested.
Good work using the UD resolution library 👍

if (bcData == null) {
// check for OpenAlias
bcData = parseOpenAlias(qrCode, false);
}
return bcData;
}

static public BarcodeData parseUD(String udString) {
Timber.d("parseUD=%s", udString);
if (udString == null || !Patterns.DOMAIN_NAME.matcher(udString).matches()) return null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default DOMAIN_NAME pattern probably won't match some crypto TLDs.
I can't double-check now, but looking at https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/util/Patterns.java#309 it looks like it won't match 888 and x domains.

Since you are already handling any errors that may be returned from the library. What do you think about removing this check altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I'll remove the domain check

});
udThread.start();
try {
udThread.join();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why start a thread and then block the UI thread waiting for it to finish anyway?

@m2049r
Copy link
Owner

m2049r commented Aug 11, 2021

how much data is leaked resolving UD (or even openalias, as UD is done first just-in-case) and to whom?
EDIT: and what exactly?

@paxriel
Copy link
Contributor Author

paxriel commented Aug 12, 2021

https://github.com/unstoppabledomains/resolution-java/blob/master/src/main/java/com/unstoppabledomains/resolution/Resolution.java#L32

From what I can see, the library uses 3 different resolvers for different domains. ENS domains will go through Cloudflare's Ethereum node, UNS domains will go through an Infura node, and Zilliqa domains will go through Zilliqa's API. For an invalid domain, the library defaults to UNS domains.

As for what data is sent out, I'm not 100% certain. For ZNS, the namehash version of the domain is sent to the API, and for ENS and UNS, it seems like the raw domain string is sent.

@nahuhh
Copy link

nahuhh commented Feb 22, 2022

@paxriel

Is this also working if scanning a qr code?
(Cake wallet will enter the address, but not perform the check until you manually interact with the field)

Is it possible to have it only have it perform a check if the address contains a period?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants