2

I am currently trying to use the polkadot-js sdk in order to transfer money between DOT wallets. I can successfully transfer money between two wallets using the api.tx.balances.transfer(destination, amount) transaction and then using the signAndSend() function, however I would like to have a third party wallet different from the transaction signer pay the ~0.015 DOT transfer fee, is this possible? I attempted to use the sign() method chained with send() and even if I call those two functions with the same wallet signing and sending I get an error "1010: Invalid Transaction: Transaction is outdated". I read online that this is most likely to do with the nonce of the transaction but I am not entirely sure how to get the correct nonce

1 Answer 1

4

The signer is always the account that pays all transaction fees. Trying to sign on one and then sending on another, won't yield results. At best where the two accounts have equal nonces it will be accepted, but the signer will still be responsible for the fees.

If you wish to make transactions on behalf of other accounts, you can look at proxies. This allows 3rd-party accounts to make transactions (set by type) on behalf of other accounts and pay the associated fees for transactions.

Assume you have account A and B and would like B to make transactions for A.

  1. Setup a proxy using account A setting B as a delegate via proxy.addProxy
  2. Send the transaction from account B via proxy.proxy

To the nonce issue you are facing, rather use the signAsync variant to retrieve the nonce from the chain, with sign you need to explicitly pass the correct nonce through as an option.

(It is a deprecated function, I'm assuming one of the reasons is because of this surprise factor since it doesn't behave analogous to signAndSend or signAsync when it comes to signing, it is much more low-level with all signing info to be supplied)

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.