3

i deployed a solana native program on the local test validator and writing a small python script to test it, my python script that's causing the error

from solana.rpc.api import Client
from spl.token.client import Token

# this is my test wallet
wallet = Keypair.from_secret("private key")

client = Client("http://localhost:8899")

token = Token.create_mint(client, wallet, wallet.public_key, 9, program_id=TOKEN_PROGRAM_ID, freeze_authority=wallet.public_key)
token_account = token.create_associated_token_account(wallet.public_key, skip_confirmation=True)

and well, the issue is when creating a token_account, i get an error saying

solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction
simulation failed: Error processing Instruction 0: incorrect program id for instruction", 
data: RpcSimulateTransactionResult { err: 
Some(Tagged(InstructionError(TransactionErrorInstructionError((0, 
Fieldless(IncorrectProgramId)))))), logs: Some(["Program 
ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]", "Program log: Create", "Program 
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]", "Program log: Instruction: 
GetAccountDataSize", "Program log: Error: IncorrectProgramId", "Program 
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 884 of 194486 compute units", "Program 
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: incorrect program id for instruction", 
"Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 6398 of 200000 compute 
units", "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL failed: incorrect program id 
for instruction"]), accounts: None, units_consumed: Some(0), return_data: None } }

and i tried the changing the program to SYS_PROGRAM_ID just to make sure, no luck, what may i do to solve this one?

1 Answer 1

2

Update your validator. I wasn't able to reproduce the problem on a fresh test validator using version 1.14.10 of the Solana CLI. Here's the full script that I ran:

from solana.keypair import Keypair
from solana.rpc.api import Client
from solana.rpc.commitment import Confirmed
from spl.token.client import Token
from spl.token.constants import TOKEN_PROGRAM_ID

# this is my test wallet
wallet = Keypair.generate()

client = Client("http://localhost:8899", Confirmed)
resp = client.request_airdrop(wallet.public_key, 1_000_000_000, Confirmed)
client.confirm_transaction(resp.value, Confirmed)
resp = client.get_balance(wallet.public_key, commitment=Confirmed)

token = Token.create_mint(client, wallet, wallet.public_key, 9, program_id=TOKEN_PROGRAM_ID, freeze_authority=wallet.public_key)
token_account = token.create_associated_token_account(wallet.public_key, skip_confirmation=True)

It might be that create_associated_token_account is happening before the mint is actually created, or the test ledger has been busted by something.

0

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.