0

I am trying to create a token after setting my wallet using the following command.

solana-keygen grind --starts-with ott:1

The wallet creation is successful. I have also configured the connection to the devnet.

solana config set --url https://api.devnet.solana.com --keypair my-keypair.json

I have also added sufficient SOL to the wallet. Now I am trying to create a token and add it to this wallet using the following command.

spl-token create-token --decimals 18 my-keypair.json

It is displaying the following error.

Creating token ottKBxXuJjtQoLXD21AM5aVFTAHJvZMuZfuUyEdL37J under program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA Error: Client(Error { request: Some(SendTransaction), kind: RpcError(RpcResponseError { code: -32002, message: "Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0", data: SendTransactionPreflightFailure(RpcSimulateTransactionResult { err: Some(InstructionError(0, Custom(0))), logs: Some(["Program 11111111111111111111111111111111 invoke [1]", "Create Account: account Address { address: ottKBxXuJjtQoLXD21AM5aVFTAHJvZMuZfuUyEdL37J, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0"]), accounts: None, units_consumed: Some(150), return_data: None }) }) })

Request your help to resolve this error.

1 Answer 1

1

The error says:

Create Account: account Address { address: ottKBxXuJjtQoLXD21AM5aVFTAHJvZMuZfuUyEdL37J, base: None } already in use",

This means that you've already created an account on address ottKBxXuJjtQoLXD21AM5aVFTAHJvZMuZfuUyEdL37J and you're trying to create it again.

Looking at the explorer, however, shows that this is a normal wallet account: https://explorer.solana.com/address/ottKBxXuJjtQoLXD21AM5aVFTAHJvZMuZfuUyEdL37J?cluster=devnet, so the error might be a bit misleading.

By providing my-keypair.json as an argument to create-token, you're trying to create a new spl token mint at the address of your wallet, which would essentially make your wallet unusable.

Instead, you can grind a new private key for your mint and use that as the argument:

spl-token create-token --decimals 18 my-other-keypair.json

Or if you provide no argument, a new random keypair will be used:

spl-token create-token --decimals 18

Side note: since SPL Tokens use a u64 to store the total supply of tokens, using 18 decimals will only give you a maximum of 18.44 tokens, so be sure to use --decimals 9!

$ spl-token create-token --decimals 18
Creating token GSsxAddWf1UbWWvSr8Dn2zgBaGzRv154dC1tpH9acE25 under program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA

Address:  GSsxAddWf1UbWWvSr8Dn2zgBaGzRv154dC1tpH9acE25
Decimals:  18

Signature: 2ANjvmy83uez3tf9ESern6FXhYndrdQgJtyf28PCGm4pWG8Gk63mruhu8589qaSQN42gc92g3LuAtD1qXqYxzbVs

$ spl-token create-account GSsxAddWf1UbWWvSr8Dn2zgBaGzRv154dC1tpH9acE25
Creating account 4WLXxPoHq1fEeHZYyH2QEd1Yy1mJde5r2nAxDjLdaNGg

Signature: hNKhgwPoxmzJLQvXv8fT2zWE9HnPq9F36rkiosy34s2FGD8TcJoXo4aAZZavG6TCFNFxGFmrCPYVgD3aEGgRjDR

$ spl-token mint GSsxAddWf1UbWWvSr8Dn2zgBaGzRv154dC1tpH9acE25 100 4WLXxPoHq1fEeHZYyH2QEd1Yy1mJde5r2nAxDjLdaNGg
Minting 100 tokens
  Token: GSsxAddWf1UbWWvSr8Dn2zgBaGzRv154dC1tpH9acE25
  Recipient: 4WLXxPoHq1fEeHZYyH2QEd1Yy1mJde5r2nAxDjLdaNGg

Signature: 26T1jU991Go1hWtAHnsmHLHJoUaY1jty9NC3VAbhMyy3d8fGjt6ntsv6ZsrWxcwm19G7siVHeLEyFGadVmhmUJCu

$ spl-token display 4WLXxPoHq1fEeHZYyH2QEd1Yy1mJde5r2nAxDjLdaNGg

SPL Token Account
  Address: 4WLXxPoHq1fEeHZYyH2QEd1Yy1mJde5r2nAxDjLdaNGg
  Program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
  Balance: 18.446744073709551615
  Decimals: 18

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.