Skip to main content
2 of 5
deleted 443 characters in body

Keypair mismatch Python

I am trying to create and partial sign a transaction for create an account, but I keep receiving a keypair mismatch error. My code looks like this:

from spl.token.instructions import create_associated_token_account
from solana.keypair import Keypair
from solana.publickey import PublicKey
from solana.transaction import Transaction

signer = Keypair()

create_transaction_instruction = create_associated_token_account(
    payer=PublicKey(mintFeePayer), owner=signer.public_key, mint=PublicKey(mintPublicKey)
)

transaction = Transaction()
transaction.add(
    create_transaction_instruction
)

transaction.sign_partial(signer)

I am using https://github.com/michaelhly/solana-py which apparently is the most python unofficial library for this, I am open to use something else if it works.

And I always get:

Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "kinetic_sdk/__main__.py", line 49, in <module>
    transaction.sign_partial(signer)
  File "/Users/alexramirez/Library/Caches/pypoetry/virtualenvs/kinetic-sdk--u4hmztD-py3.8/lib/python3.8/site-packages/solana/transaction.py", line 299, in sign_partial
    self._solders.partial_sign(underlying_signers, self._solders.message.recent_blockhash)
solders.SignerError: keypair-pubkey mismatch
make: *** [run_sdk] Error 1

Thanks.