5

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?

1 Answer 1

5
  • What exactly is an off-curve address used for?

An off-curve address is anything that isn't on-curve so like you said any address which cannot have a corresponding private key.

so if you craft up an address Lifok11111111111111111111112..., this would very likely be off-curve, while not very useful since anything sent there would be lost forever.

  • How are they created? (Assuming that we are talking about program dervied addresses now)

Solana has this unique mechanism, program can sign instructions by providing a program derived address and the corresponding seeds to derive it (to prove it is indeed an address derived from this program address). They are never technically "created", they are simply used at runtime given what the program code allows.

You can see how create_program_address works here (it derives an address from some input, but doesn't "create")

https://github.com/solana-labs/solana/blob/1095cdf43625596a1603f1d33e8697951aa669e2/sdk/program/src/pubkey.rs#L572-L588

So it is an address made of the bytes obtained from sha256(&[seeds, program_id, PDA_MARKER])

In the specific case of cteamyte8zjZTeexp3qTzvpb24TKRSL3HFad9SzNaNJ, it seems to be a multisig/fee account, most likely for Degods/y00ts staking as it receives some DUST and SOL when user interact with the Cardinal staking program

More about program derived addresses:

https://solanacookbook.com/core-concepts/pdas.html#facts

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.