I'm trying to retrieve an associated token address, and found this random vanity wallet while looking through solscan.
From running the code below, here are the results.
Expected token address: 6xkatYuEkMxKZaGBpjnubH53tYyp1jmruaLzgJKFxfjR
Actual token address: TokenOffCurveError
const mint = new PublicKey("DUSTawucrTsGU8hcqRdHDCbuYhCPADMLM2VcCb8VnFnQ")
const owner = new PublicKey("cteamyte8zjZTeexp3qTzvpb24TKRSL3HFad9SzNaNJ")
const tokenAddress = await getAssociatedTokenAddress(mint, owner, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID)
Of course if I simply set the allowOffCurve
flag to true
, I will get the expected token address back.
What exactly is an off-curve address used for? How are they created? Should I assume that public keys in general can be off-curve?
Edit: What I've noticed is that off-curve public keys don't have private keys. How exactly is this even generated/used then?