1

1. ABSTRACT OF THE PROBLEM

In order to explain my problem, I thought the best way was to put copy & paste of the instructions I put and the answers I got from Solana Network.

There is at least 2 different problems in the overall problem related to AJSP Fungible Token:

i) The token balance returned by Solana Network thru spl-token instructions is 0, 500001 or 500001 000000000, depending on the instruction used. So, there are 3 different token balance, which one is the right one? Naturally, the one with 9 more 0s is probably related to the fact that I authorized 9 decimals at the creation of the token.

ii) There is 1.0021616 SOL on the token mint address and I can not send it to the Sol Public key that owns this token mint address, even if I close the token mint with spl-token instruction spl-token close-mint How to liberate this 1 SOL coin to the Sol Public Key?

DETAILED DESCRIPTION OF THE PROBLEMS

2. PROBLEM #1: TOKEN BALANCE RETURNED BY SPL-TOKEN INSTRUCTIONS

2.1 INTRODUCTION

Here, to explain the problem, I suggest to copy & paste a succession of spl-token and solana instructions given to Solana Network and the response I received from Solana Network. I work with a visual studio terminal that I installed in my Windows PC and I interact with Solana Network thru my internet link. It is all in real time and connected to the "blockchain" (I prefer network in lieu of blockchain that relates to our Beloved slow BTC).

2.2 LIST OF SPL-TOKEN & SOLANA INSTRUCTIONS AND SOLANA RESPONSES

-C:\Users\alain\MyProjects\mint-fungible-spl>solana address

DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token accounts

Token Balance


4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP 0

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token account-info 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

SPL Token Account

Address: 57iC7ifUj6Wpb8ZZAPepeVxWtE8SW7XTqPCdDRBmLcs7

Program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

Balance: 0

Decimals: 9

Mint: 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

Owner: DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN

State: Initialized

Delegation: (not set)

Close authority: (not set)

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token balance 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

0

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token close-mint 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

Error: "Mint 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP still has 500001000000000 outstanding tokens; these must be burned before closing the mint."

2.3 REPORT FROM SOLSCAN.IO ABOUT TOKEN MINT (AJSP) 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

https://solscan.io/token/4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

2.4 MY ANALYSIS OF THE TOKEN BALANCE RETURNED BY SOLANA NETWORK (DIFFERENT RESUTLS)

What is the problem? The problem is that Solana returns 3 different token balance, depending on the instruction used. Which one is the right one?

First, without being sure, I think that the different in token balance is due to the fact that I closed the token mint before and reopened it after thru spl-token instructions in my Visual Studio terminal.

2.4.1 Most spl-token instructions returns a balance of 0 token

spl-token balance 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP returns a balance of 0 token.

All other spl-token instructions returns a 0 balance, except if I ask to close the token-mint with the proper spl-token instruction (spl-token close-mint).

2.4.2 spl-token close-mint returns 500 001 000 000 000.

spl-token close-mint 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP returns a token balance of 500 001 000 000 000.

For which, I think there is 9 more 0s to highlight the fact that this fungible token has 9 decimals after the point.

2.5 What solution do I expect for the difference in token balance returned by Solana Network in view of spl-token instructions?

Well, I think I understand that this difference in token balance comes from the fact that I closed the token mint before (to transport its SOL balance to the Sol public key). However, for some strange reasons, I can no longer close the token mint now and the 1.0021616 SOL is still hanging on the token-mint balance.

So, per my understanding, the token-mint balance should be the total of all minted tokens since the beginning of minting. Otherwise, it creates a “potential confusion”.

3.0 PROBLEM #2, THE AMOUNT OF SOL STORED IN THE TOKEN MINT ADDRESS

Again, to explain the problem, I will copy and past instructions that I exchanged with Solana Network infrastructures.

3.1 INSTRUCTIONS MADE TO EXPLAIN MY CASE OF SOL STORED – IMPRISONNED IN TOKEN-MINT

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana address DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token accounts

Token --- Balance


4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP 0

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token account-info 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

SPL Token Account

Address: 57iC7ifUj6Wpb8ZZAPepeVxWtE8SW7XTqPCdDRBmLcs7

Program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

Balance: 0

Decimals: 9

Mint: 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

Owner: DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN

State: Initialized

Delegation: (not set)

Close authority: (not set)

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana balance 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

1.0021616 SOL

  • C:\Users\alain\MyProjects\mint-fungible-spl>spl-token close-mint 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

Error: "Mint 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP still has 500001000000000 outstanding tokens; these must be burned before closing the mint."

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana transfer --help

solana-transfer

Transfer funds between system accounts

USAGE:

solana transfer [FLAGS] [OPTIONS] <RECIPIENT_ADDRESS> <AMOUNT>

-- I removed the help text to reduce the size of my question ---

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana transfer --allow-unfunded-recipient --from 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN 1

Error: Dynamic program error: missing signature for supplied pubkey: 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana config get

Config File: C:\Users\alain.config\solana\cli\config.yml

RPC URL: https://api.mainnet-beta.solana.com/

WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)

Keypair Path: c://users/alain/.config/solana/id.json

Commitment: confirmed

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana transfer --allow-unfunded-recipient --from 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP --keypair c://users/alain/.config/solana/id.json DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN 1

Error: Dynamic program error: missing signature for supplied pubkey: 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

  • C:\Users\alain\MyProjects\mint-fungible-spl>solana transfer --allow-unfunded-recipient --from 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP -k c://users/alain/.config/solana/id.json DQD4y9AL2eWHH4gyc8NC1fzEMo6EZn4LuHwCghq5LnzN 1

Error: Dynamic program error: missing signature for supplied pubkey: 4ZSG9zyxCsDa9VKtXUHkw48aNJS5aikETjA8Z1mP2vcP

3.2 ORIGINAL TRANSACTION BETWEEN MY OWN ACCOUNTS THAT TRANSFERRED 1 SOL TO THE TOKEN-MINT ADDRESS

The original transaction was between one of my Phantom wallets to the token-machine but in lieu of sending to the Solana Public Key of the Token machine, I experienced a brain cramp and sent the 1 Sol to the Token mint address. Since this time, the 1 SOL is trapped in the Token Mint address and I can not remove it.

First, it has to be understood that I own both accounts. The Token-Machine is owned by me and the Solana Public Key also. Since the Token Mint is owned by the Solana Public Key, I technically own both accounts. However, the system prevents me from cancelling the transaction or moving the funds from the token mint address of the token machine.

3.2.1 SOLSCAN.IO RECORD OF THE TRANSACTION SENDING 1 SOL TO THE TOKEN MINT ADDRESS

https://solscan.io/tx/32VonL65xkm9LpneVjypiruYrhcNfcBJLsbEDzoMGBv5kWgzPETb3j82AunQicTZeWd7XLbUVc8XLgsyog3QbokR

3.3 SOLUTIONS SUGGESTED

I suggest the following solutions to Solana experts:

i) returns funds to my original Phantom Wallet account (Fao5bYyzowEY8rCMBmkATrwfkNX4D529pmifnBT3pxC1)

ii) force return of the SOL on the token-mint to the Solana Public Key of the Token Machine, where it is supposed to be anyway.
In both cases, I am owner of all the accounts.

1 Answer 1

2

I think you have a bit of a misconception. Every token on solana has a mint account which stores all the data about a token. These tokens are then saved in token accounts. There is usually one token account which saves the token for a mint. The assiciated token account which is derived from the mint of the token and wallet you are sending it to.

To get the amount of tokens you own you would use this function in js:

import { getAccount } from '@solana/spl-token';
const parsedTokenAccountInfo = await getAccount(connection, tokenAccount);

and you find the fitting token account to a wallet like this:

const assotiatedTokenAccount = await getAssociatedTokenAddress
(
    mintkeyPair.publicKey, 
    keyPair.publicKey,
    false,
    TOKEN_2022_PROGRAM_ID
); 

The output will then be:

tokenAccountInfo {
  address: PublicKey [PublicKey(7iFn7U1uPWwe4z47v3fP28Mc5F9pqmgYrz9UsjdtzvAj)] {
    _bn: <BN: 63b7a4dec1368066ff069b2a1e84d584dfde9d7a6ea7a520e4945352abef4cc0>
  },
  mint: PublicKey [PublicKey(GiyzqXQUeQr3HZcF9W7a4pDGGbj6qsqxcAKmkFH75tXY)] {
    _bn: <BN: e9a0906181e586a3ad825d611c6e92e4fabb5d5152cdbd8a4f3d52dbd9cc1d17>
  },
  owner: PublicKey [PublicKey(5vJwnLeyjV8uNJSp1zn7VLW8GwiQbcsQbGaVSwRmkE4r)] {
    _bn: <BN: 4916d20d019fe32a08c4facde04ed651a95b3798ed738891df27f4e610cbe02b>
  },
  amount: 5000000000n,
  delegate: null,
  delegatedAmount: 0n,
  isInitialized: true,
  isFrozen: false,
  isNative: false,
  rentExemptReserve: null,
  closeAuthority: null,
  tlvData: <Buffer 07 00 00 00>
}

This is the amount of tokens you own and the you need to devide it by the decimals the token mint as defined if you want to show it in a nice way.

If you try to close a mint of a token you will only be able to do that when there are not more tokens of that mint in any token account. So the amount you see when you try to close the mint is all the tokens that are currently existing.

You should never send sol to a token account or a token mint. You will only get the sol back if you burn all the tokens out of the token account and close it and for the mint if all existing tokens are burned.

1
  • Dear Jonas H., First, I would like to thank you for your short and clear answer. I would like to add a few comments : A) I have been able to close the token-mint account before even if there were tokens in circulation. This hints at another register for total tokens. B) Solana infrastructures are working well but have a little subtility. C) It is clear for me that Solana has the best Coin and Network for any users. D) I believe it is possible to remove the SOL trapped on the token mint. I don't know how to do it now? I suspect I can do with Metaplex Instructions.
    – AJSP
    Feb 16 at 7:45

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.