1

I want to decode and check if the given hex data for the transaction is valid and signed correctly.

The flowing is how I currently construct the transaction and convert it to hexadecimal format.

    let addProxy = api.tx.proxy.addProxy(PROXY, 'Any', 0);
    let remark = api.tx.system.remark("Test");

    let tx = api.tx.utility.batch([
        addProxy,
        remark,
    ]);
    let singedTx = await tx.signAsync(pair);
    let signedTxHex = singedTx.toHex()
    
    console.log("Signed TX", signedTxHex);

2 Answers 2

1

Do you need to do it in PolkadotJS? Otherwise you can use the tool Subkey: https://docs.substrate.io/reference/command-line-tools/subkey/ with the command:

subkey verify <your-signedTxHex> <pair.address>
1

As Jaco explained in this GitHub issue, you can't just verify the signature of a transaction with polkadot.js.

Alex's answer is a good alternative by using the tool Subkey.

However, if instead of transactions, you want to verify just messages, you can do that with the util-crypto package of polkadot.js. Here you have the documentation for it.

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.