1

Let's say I create and sign with my keys a transaction to swap USDC for ETH with all the required parameters (both parameters for the swap and tx parameters like gas, etc), but I don't send it. If I give this transaction to my friend, could he simply send it whenever he pleases (let's say a week later) and still have it executed on chain? Let's assume that of course he doesn't have my private key.

Edit to add another question: If my friend sends the transaction and fails, is it necessary that I sign a new one or could the previous one still be used until it's successful?

1 Answer 1

0

Q1. Yes, with a signed transaction, it can be broadcasted later by anyone and get executed when included in a block.

Q2. If the transaction fails, you will need to sign a new one. Every transaction has a nonce so that it specifically can only be executed once. You can sign a new transaction with all the same parameters and only the nonce increased (by 1).

2
  • And I guess that if I sign a transaction with my current nonce and give it to my friend, and then I send myself an unrelated transaction to the blockchain (so now the nonce of my address increased by 1), the one that my friend is holding is rendered useless because the nonce that it was signed with has been used already, right? Thanks!
    – Hiperfly
    Commented Nov 1, 2022 at 6:04
  • @Hiperfly Yes, you're right.
    – eth
    Commented Nov 7, 2022 at 6:20

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.