I am using Magic Eden's API to generate a buy transaction, and it returns the bytes of the transaction. I'm using Python, solanapy and solders to send the transaction. However I don't know how to interpret the bytes and send them. Here is my code:

msg = VersionedTransaction.from_bytes(bytes(data[0]))
sig = wallet.sign_message(bytes(msg.message))
response = httpClient.send_transaction(
    opts=TxOpts(skip_preflight=False, skip_confirmation=True),

Where data[0] is the list of bytes that is returned by Magic Eden. This code gives me the error:

solders.TransactionError: Transaction did not pass signature verification

If I remove the verify, it compiles but the signature is 1111.....111. Any help is appreciated.

EDIT: I now have this, which seems to be very close to the actual solution however I'm getting this error New code:

raw_tx = VersionedTransaction.from_bytes(bytes(data[0]))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature])

txid = httpClient.send_transaction(
    opts=TxOpts(skip_confirmation=False, skip_preflight=False),

Error when sending transaction:

solana.rpc.core.RPCNoResultException: invalid transaction: Transaction failed to sanitize accounts offsets correctly
  • You don't have to show the full thing, but can you include the link to the magic eden function that gives data as its result?
    – Ademola
    Dec 28, 2023 at 18:15

1 Answer 1


Here is the solution:

raw_tx = VersionedTransaction.from_bytes(bytes(data))
signature = wallet.sign_message(to_bytes_versioned(raw_tx.message))
signed_tx = VersionedTransaction.populate(raw_tx.message, [signature ,raw_tx.signatures[1]])

The data is the signed message from Magic Eden. You have to turn the list into a list of bytes. Then you sign the message and get the signature. Create a new versioned transaction with the message and the signatures from Magic Eden and yours.

And then you can send it using client.send_transaction(...).

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.