1

I'm building an application whose architecture decouples transaction composition, signing, and publishing. These processes literally live in separate components that communicate with each other, but do not belong on the same application.

This means that after composing a transaction with:

const tx = api.tx.pallet.dispatchable(...args);

I don't want to use signAndSend, but instead sign the raw encoded call, and once I have the signature, I need to publish it to a substrate node. The info I have at this point is encodedCall and signature.

How can I publish a transaction with that information alone? Is there a way to reconstruct the SubmittableExtrinsic object to use .send()? Or is there a way to make a raw RPC call that achieves the same result?

Update: My question is: what would the third parameter of sign() be?

9
  • Check out this answer substrate.stackexchange.com/a/7198/380
    – forgetso
    Nov 6, 2023 at 11:23
  • That's great info! However, it's not the complete solution. I can recover the SubmittableExtrinsic with api.tx(encodedTx), but the signature is also obtained in a decoupled manner. So I would need to do something like this: tx.addSignature(sender, sig, ???). I don't really know what the third param of addSignature is supposed to be, though... Nov 6, 2023 at 12:55
  • I'm not sure I understand. If you don't want to use signAndSend, just use sign. This gives you a signed transaction that you can broadcast at a later date. You don't need anything else.
    – forgetso
    Nov 6, 2023 at 13:25
  • My question is: what would the third parameter of sign be? Nov 7, 2023 at 14:12
  • 1
    @Simson Shouldn't it be closed as a duplicate?
    – forgetso
    Nov 9, 2023 at 9:47

1 Answer 1

1

The third parameter of sign is the payload, which can be constructed by following the instructions in this answer.

Not the answer you're looking for? Browse other questions tagged or ask your own question.