hirosystems / explorer

Explore transactions and accounts on the Stacks blockchain. Clone any contract and experiment in your browser with the Explorer sandbox.
https://explorer.hiro.so/
MIT License
134 stars 103 forks source link

Bug: Searching for a fresh address yields nothing: possible fix #1078

Open 314159265359879 opened 1 year ago

314159265359879 commented 1 year ago

Describe the bug Sometimes searching for an address doesn't yield a result. Visiting the address by editing the normal URL will still reveal the address, usually with no activity.

Transaction ID n.a.

To Reproduce Steps to reproduce the behavior:

  1. Go to explorer.hiro.so
  2. Search for a newly created/revealed address
  3. See error: image

When instead you visit: https://explorer.stacks.co/address/SP1EYQ4TXYXXP6QY6AM6X15J0KFE4YMYYMRSK23S?chain=mainnet image

Expected behavior I am not sure if this is expected behavior, perhaps not the most user friendly? Is this happening because the address is not yet considered initialized and that is why it is not yet available in the search index?

Should it be considered initialized as a user searches for it? Can you just default to visiting this kind of page? https://explorer.stacks.co/address/<address>?chain=mainnet that would be more user-friendly.

andresgalante commented 1 year ago

Thanks for reporting it. I could reproduce it. Here is an example address SP2AE0JFBMFZFYK52TVE2KR2MFXVJGMSDBVGA8NYT

andresgalante commented 1 year ago

We think it is an issue with the search API, @rafaelcr can you take a look, please?

https://api.hiro.so/extended/v1/search/SP2AE0JFBMFZFYK52TVE2KR2MFXVJGMSDBVGA8NYT?include_metadata=true&unanchored=true

rafaelcr commented 1 year ago

Hmm yeah, unfortunately the API doesn't know this address exists until it has at least 1 transaction so I don't believe there's anything we can do API side here

Could the Explorer maybe detect it is a valid Stacks address and autocomplete that (if the API doesn't return anything)?

andresgalante commented 1 year ago

We'll close this issue until the API can inform valid addresses with no tx.

314159265359879 commented 1 year ago

Is there a related API enhancement issue so we can link to it here?

314159265359879 commented 10 months ago

@andresgalante I see this is added to a Q3-2023 milestone. I think having a solution for this problem could help resolve issues for users trying to withdraw to a fresh address. Those are sometimes falsely classified as invalid.

I have seen cases like this from Binance, Kraken and Okcoin: A. Users get an error "invalid address" on an exchange when they try to withdraw to a fresh address B. The Exchange representative says the address doesn't exist (they search for it on explorer.hiro.so and come to that conclusion, this fix will prevent this from happening in the future). image

image

As in the (okcoin) example above though, the address can be seen (without activity) when the link to it is manually created: https://explorer.hiro.so/address/SP18A9HKJNGT89K8QVSJBJ5862Q0807K7J3TKHNEP?chain=mainnet

Known reasons on exchanges to falsely classify a STX address invalid are:

  1. (Trailing) spaces with the address
  2. Exchange validating addresses with a certain length only for example 40 characters (Stacks address length can vary and 40, 41 characters are most common)
  3. Pasting an incomplete address.
  4. (odd one) not having a memo, or an "invalid" memo

I wonder if this is another reason. It would definitely explain some cases from the past, I will test this hypothesis and update here when I can confirm it.

Good we already know what can be done to resolve it.

obycode commented 10 months ago

stacks.js has a validateStacksAddress function that could be helpful here.

andresgalante commented 10 months ago

Thanks @314159265359879 let me reopen this issue and we'll take a look