2

Is there a way to sign a transaction by a user, and apply it by an other so that the second account pays the gas?

In two words: The transaction signer is Bob, the transaction injector in the Blockchain is Alice for example.

Just like in Ethereum with web3.js, we can use "encodeABI" method to encode the transaction and sign it by a user and apply (inject it in the blockchain) it by an other.

1

You can do it with a smart contract. Place the user's funds in a smart contract that takes

  1. A lambda returning a list of operations
  2. A counter
  3. A signature by a given key of the above

(technically you don't really want to explicitly pass the counter, you can just assume the one in your storage is the one that was signed)

And

  1. Checks the signature
  2. Checks and updates the counter
  3. Executes the lambda and return the operations

This would be very similar to the manager.tz contract except that instead of having the access controlled by checking SENDER, you control the access with a signature and a counter.

Now, have the user produce the lambda and the signature, and any third party can pay a fee to inject this payload into the contract and trigger transactions.


A more direct way to do that would be to allow manager operations, which already represent bundles of operations, to involve multiple accounts and multiple signatures so that the fee can be paid by another party. This would be a small, but useful protocol upgrade.

2
  • Thank you for responding. My stack is: SmartPy / Taquitos. 1. Can you explain more : A lambda returning a list of operations? 2. How to check for the signature in the smartPy smart contract? 3. How to execute a lambda function in a smartPy smart contract?
    – Daly
    Jan 29 '20 at 9:24
  • 1
    Those are smartpy related questions, you should open different questions for them
    – Arthur B
    Jan 29 '20 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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