Skip to content

Fail to sign transaction. Error: could not decode result data (value="0x", info={ "method": "readNonce", "signature": "readNonce(uint256)" }, code=BAD_DATA, version=6.13.5) #457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BestStream opened this issue Apr 22, 2025 · 13 comments

Comments

@BestStream
Copy link

I create such a request:

var request = new TransactionRequest {
to = "0x978a0D022f6dF0A8FD5144604950e3bAd5516A66",
value = "0x0",
data="0xa9059cbb00000000000000000000000036d6279b6f403db3bcbeb5c4a7cdfa55f4a3e2bf0000000000000000000000000000000000000000000000000000000077359400" };

Then call await _passport.ZkEvmSendTransaction(request)

And get this error
could not decode result data (value="0x", info={ "method": "readNonce", "signature": "readNonce(uint256)" }, code=BAD_DATA, version=6.13.5)

If I send the same transaction via MetaMask everything works

@zhenweileeimx
Copy link

zhenweileeimx commented Apr 25, 2025

Hi BestStream, we've begun early analysis of this, could we check a few things, firstly is this TransactionRequest being sent via the Unity SDK , if so which version of the Unity SDK are you on? We also checked that contract is "Life Coin (LFC)" on Immutable ZkEVM testnet, and you have correctly set value as 0x0, as we do not support payable transactions. The issue seems to be related to the data payload, could you share more on what the transaction purpose is, in many cases the contract will need to be pre-approved via this process first, https://docs.immutable.com/guides/zkevm/game-currencies/pre-approved-transactions/ could you indicate if you've done so? I would also like to further inspect the payload, could you share the breakdown of it, I noticed you are calling the transfer function(0xa9059cbb), but would also like to check what params filled in etc, and how it was generated, the issue likely lies in mis-constructed payload or not yet approved transaction, as all transactions in game/unity has to be pre-approved
? Here's a sample guide of how we advise games to construct payloads generally. https://docs.immutable.com/tutorials/zkEVM/build-unity-game/crafting

As a sanity check, do also update to the latest version of the SDK that you are using as we had earlier resolved an issue in the SDK that may cause this error

@zhenweileeimx
Copy link

zhenweileeimx commented Apr 25, 2025

Image

Do also recommend trying to build the payload here https://passport.immutable.com/sdk-sample-app and compare it, you can also try to perform the transaction in that sample web app first to validate that the payload is correct, and remember to update your SDK version to the latest, please let us know if this helps to resolve the issue, our teams will look into it further if not yet resolved, early next week!

@BestStream
Copy link
Author

BestStream commented Apr 25, 2025

I'm just trying to test if our token transfer works via your wallet. As I mentioned, the same transaction works via MetaMask. I expect that work via your wallet will be similar to work via MetaMask as a generally accepted standard. I prepare the transaction exactly the same way as I do it for MetaMask (and any other web3 evm compatible wallet). If some pre-approval actions is required - I expect to see the corresponding error text, so as not to guess about the causes of the problem. And yes, I use the current version of Unity and Immutable SDK

@BestStream
Copy link
Author

So, I have read your documentation about pre-approved transactions. As I understand it, this is a mechanism that allows transactions to be sent without asking for the user’s permission each time. It looks like this is an optional mechanism — if I’m fine with asking the user for permission every time a transaction is sent, I can simply ignore it. If I understood correctly, then how is this related to my issue?

@BestStream
Copy link
Author

"I would also like to further inspect the payload, could you share the breakdown of it, I noticed you are calling the transfer function(0xa9059cbb)" - That's right, this is a standart ERC20 token transfer function. The data is generated by the Nethereum plugin (works for MetaMask)

@BestStream
Copy link
Author

BestStream commented Apr 26, 2025

First of all, I am frustrated by the error text "readNonce". What does it mean? How does it relate to the action I am about to take? It looks like your wallet wants to read the nonce for some reason and can’t do it.

@BestStream
Copy link
Author

I tried to send a transaction through the sample app interface and got this error "Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature"

Image

@BestStream
Copy link
Author

I was informed that pre-approval is not optional, but a mandatory feature. So I added contracts to the Hub. However, it did not help.

I tested it on the production environment, and the transactions were signed successfully! So the mystery is solved!

  1. So please add to the documentation that adding contracts via the Hub is a mandatory requirement.

  2. Find the cause of the problem in the test environment, because the problem is not reproducible in the production environment

@nattb8
Copy link
Collaborator

nattb8 commented May 7, 2025

Hi @BestStream ,

Good to hear that it's working on production for you.

  1. This is documented in the prerequisites list here - last bullet point, which links to this.

Image

  1. We'll have a look what's the issue with the test environment

@BestStream
Copy link
Author

BestStream commented May 8, 2025

@nattb8 "This is documented in the prerequisites list here..." - I haven't seen this part of the documentation, I saw the description of the method here and there are no prerequisites https://docs.immutable.com/sdks/zkEVM/unity/sdk-reference#zkevmsendtransaction (anyway, as I found out, my bug is not related to prerequisites)

@BestStream
Copy link
Author

In any case, it's terribly frustrating when you can send a transaction through MetaMask, which everyone uses, but you can't through your wallet. Moreover, now thanks to the link you shared I saw that there is a group of transactions that are completely impossible to send - it's just terrible!

@nattb8
Copy link
Collaborator

nattb8 commented May 12, 2025

Hey @BestStream, I was able to reproduce the issue, and it seems to only affect newly created wallets. We've addressed this in TypeScript SDK v2.2.0, which is included in the latest Unity SDK release.

Could you please try updating to Unity SDK v1.33.1 and let us know if the issue persists?

@BestStream
Copy link
Author

@nattb8 We have updated to v1.33.1 and I can confirm that the error no longer occurs. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants