0

I am curious if it's possible to extract a signed transaction, without executing the call completely, against a certain function in a contract? The extracted signature is then saved and fully executed at a later stage.

Scenario:

Setup:

  1. contract 1 = Game
  2. contract 2 = Impersonator
  3. actor 1 = Player
  4. actor 2 = Handler

The Game contract has a payable function called Roll:

contract Game { function roll() public payable { // roll a radom number } }

The Player wants to call the roll function but goes through the Imporsonator contract.

The Impersonator contract has a saveRollTrx payable function that saves the signed trx from Player towards the function 'roll'

contract Impersonator { function saveRollTrx() public payable { uint256 sig = gameContract.roll(); // somehow extract the signature without executing the call? } }

The Imporsonator contract would also have a second function that the Handler actor could execute with the saved signature towards the roll function on the Game contract on behalf of Player.

  • 1
    in ethers call populateTransaction: https://ethereum.stackexchange.com/questions/84561/building-a-raw-contract-transaction-with-ethers-js – high_byte Jun 16 '22 at 21:28
  • @HananBeer, this looks a bit like what I am looking for. Two questions: 1) Can this to be done within the Solidity contract itself? 2) So the player executes the populateTransaction and I can then execute the sendTransaction? It doesn't have to be the user executing the sendTransaction as well? – Casper Nybroe Jun 17 '22 at 08:08
  • 1
    use abi.encodeWithSignature or the likes: https://ethereum.stackexchange.com/questions/112562/how-do-you-pass-abi-encoded-parameters-to-abi-encodewithsignature-abi-encodewi – high_byte Jun 18 '22 at 09:13

0 Answers0