Skip to main content
Expand sign vs signAsync
Source Link
Xiu Hung
  • 527
  • 3
  • 9

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)

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)

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)

Source Link
Xiu Hung
  • 527
  • 3
  • 9

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)