I can get an associated token account knowing the mint address and wallet address with spl_associated_token_account::get_associated_token_address function

But is it possible to get a mint address, when knowing only the wallet address and associated_token_address?

for example, if we know this associated token account CfUzkuDDdUvoBsK4vr134DV7Tb3CADHtsPL4Zs4UuAQs and its owner's wallet address 7REXxsREHYPbMrxShwRjqAhS5VxWpoCCkzfRicgxrvek

can we get the usdc mint address https://solscan.io/token/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v ?

or somehow to understand that this associated token account is an account for usdc?

Have to avoid rpc calls for speed

1 Answer 1


There is no way(short of bruteforce) to get the original inputs that resulted in the SHA-256 hash produced by the get_associated_token_address function.

Hence the answer to your question is unfortunately no; there's no way to reverse the derived address to get the mint that produced it.

If you really need to get rid of RPCs, you might want to consider setting up an off-chain index that stores the information you need.

  • Maybe you've some repo that could be a good example of such an index? thank you!
    – Scott
    Aug 1, 2023 at 7:42
  • I don't have an example but it'll be quite the same as setting up database storage for any other web application. This seems like a useful tool for generating db schemas from your anchor-idl. disclaimer: I've never actually used it myself though
    – Ademola
    Aug 1, 2023 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.