Skip to content
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

1010:Invalid Transaction:Transaction has a bad signature #5907

Open
Wangmmx opened this issue Jun 12, 2024 · 9 comments
Open

1010:Invalid Transaction:Transaction has a bad signature #5907

Wangmmx opened this issue Jun 12, 2024 · 9 comments

Comments

@Wangmmx
Copy link

Wangmmx commented Jun 12, 2024

I got this error when transfer KSM with the @polkadot/api v11.2.1 lib, and sign with @polkadot/types v11.2.1

    let transfer = api.tx.balances.transferAllowDeath(BOB, 1);
    let signedHex = transfer.sign(pair, {era:0, runtimeVersion: { specVersion:runtime.specVersion, transactionVersion:runtime.transactionVersion}}).toHex()
//broadcast the signedHex

And pair can be any random one, I had never got this error before, could you please help me with this? Thanks a lot

@csquan
Copy link

csquan commented Jun 13, 2024

same too,any solutions?

@TarikGul
Copy link
Member

On Kusama the CheckMetadataHash signed extension was added which acted as a breaking change. Support for it has been added to the api in 11.1.1 - That being said, I have been able to successfully send transactions in Kusama, but I can double check using .sign

@TarikGul
Copy link
Member

TarikGul commented Jun 13, 2024

Try adding mode: 0 to the signerOptions.

@csquan
Copy link

csquan commented Jun 17, 2024

how to adding mode: 0 to the signerOptions?

@csquan
Copy link

csquan commented Jun 17, 2024

seems add field metadataHash and mode in payload,but I do not test it .

@TarikGul
Copy link
Member

Yea you just need to add mode: 0 to the signerOptions which is just a options object at the end of sign

@malingzhao
Copy link

const provider = new WsProvider('wss://kusama-rpc.polkadot.io');
const api = await ApiPromise.create({ provider });
console.log("the address is =========")
console.log(sender.address)
// Estimate the fees as RuntimeDispatchInfo using the signer
const info = await api.tx.balances.transferAllowDeath("F7B8Hd9LrEyeLFdcXnf81NcNH75W4UobQ81viZBVTVFsRhK", 1).signAndSend(sender, {mode:0})

v11.3.1 how does the err resolve

@Wangmmx
Copy link
Author

Wangmmx commented Jun 19, 2024

I have no idea why got this error after adding the mode:0 to sign function, at last I solved it without using this sdk, create it offline and sign it in local environment, and also the signerPayload need add {mode:0, metadataHash:''}, and send it online

Or I use the other function can success too, after build the transfer, then

  await transfer.signAndSend(pair, {mode: 0}).then(function (ret) {
      console.log(ret)
   })

@malingzhao
Copy link

ok

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

No branches or pull requests

4 participants