Every token on Solana is currently deployed with one of two different programs:
- Token Program:
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
- Token-2022/Token Extensions program:
TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb
What you're asking for is "how can I find the mint address of a token given a specific token account?"
Given a token account 3JpjbbqkGQEwedw7ZHcV3E2cxWrTAbuJeiWiTXW7USTq
, you can find the mint by querying the account:
curl --location --request POST 'https://api.mainnet-beta.solana.com' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "getAccountInfo",
"params": [
"3JpjbbqkGQEwedw7ZHcV3E2cxWrTAbuJeiWiTXW7USTq",
{
"encoding": "jsonParsed"
}
]
}'
Response:
{
"jsonrpc": "2.0",
"result": {
"context": {
"apiVersion": "1.17.21",
"slot": 254055034
},
"value": {
"data": {
"parsed": {
"info": {
"isNative": false,
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"owner": "NjordRPSzFs8XQUKMjGrhPcmGo9yfC9HP3VHmh8xZpZ",
"state": "initialized",
"tokenAmount": {
"amount": "212674332017",
"decimals": 6,
"uiAmount": 212674.332017,
"uiAmountString": "212674.332017"
}
},
"type": "account"
},
"program": "spl-token",
"space": 165
},
"executable": false,
"lamports": 2039280,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"rentEpoch": 18446744073709551615,
"space": 165
}
},
"id": 1
}
You can see from this getAccountInfo
RPC API call, the mint is EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
. Doing a lookup on the mint address, you'll find it is USDC.