2

I receive a serialized versioned transaction from a 3rd party API that allows me to list NFTs in specific marketplaces.

However, when I get the response, transmit it to my front-end, sign it, and send it back to my back-end for submission, the blockhash gets invalid, or maybe the received transaction arrives with an invalid blockhash.

In any case, it always ends up getting rejected by the chain with the "blockhash not found" error.

Since the received transaction doesn't include anything but only the instructions, I want to build a new VersionedTransaction and send it to user for signing.

However, I am not sure how to achieve this because AddressLookupTableAddresses and compiled instructions make it difficult to achieve what I want to do.

How to rebuild a versioned transaction from an existing one?

I use both connection and Umi in the project so, any kind of solution is okay!

2 Answers 2

1

Unfortunately, this might be a problem with the API that you're using. If they provide a partially signed transaction, you cannot update the transaction without invalidating their signature, so you need to use whatever they provide.

If their API is correct, then you may be sending the transaction to the wrong network. For example, if they sign against a blockhash from mainnet-beta, then you cannot send that transaction to devnet. Check and see which network the blockhash is coming from. If you can't find it on mainnet-beta, devnet, or testnet, then it might be a problem on their side.

0

You just need to replace the blockhash with a new one right before you sign it.

Are you using @solana/web3.js package on your website?

3
  • Yes. The problem is that blockhash is read-only when I deserialize transaction from string. So, I can not change it.
    – Oguzhan
    Commented Jan 23 at 1:43
  • Can you update details about the code you use for deserialize
    – wei1769
    Commented Jan 23 at 2:39
  • Not sure what do you mean by updating details of deserialization oce. There is not much of option for versioned transaction: "umi.transactions.deserialize(base58.decode(rawStringTransaction))" or "VersionedTransaction.deserialize(base58.decode(rawStringTransaction)"
    – Oguzhan
    Commented Jan 23 at 3:01

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.