2

Is it possible to send private key signed transactions directly from the contract? The thing I want to do is to create a similar function

function sendTransactionForUser(_signedData, contractAddress){ sendSignedTrx(contractAddress, signedData) }

the main point is that the user would sign data -> send it to the owner -> owner would send transaction on behalf of the user, and pay gas for the user.

3 Answers 3

1

Implement gas station network, paymaster will pay gas fees for sender user. You can implement gas station network on any chain.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 27, 2021 at 15:05
0

Your title and description mix up some important concepts.

In Ethereum, all activity starts with a transaction signed by an externally owned account. A contract has no known private key and cannot sign a transaction.

But, you don't want the contract to sign. You want the original sender to sign and pass the siged transaction to someone else (you said, the owner).

Good news. If the sender signs the transaction, then anyone can relay it.

Hope it helps.

2
  • Hello and thank you for the answer. I have a few questions. How can I sign the data using web3? Will the signed data be a type string? How would that transaction in a contract look like?
    – JustinZ
    Commented Feb 11, 2019 at 17:13
  • This might help you get started: ethereum.stackexchange.com/questions/3386/… Commented Feb 11, 2019 at 17:18
-2

In short, yes, you can, but why would you sign with a contract? You would need to give your private key to it, and anyone would be able to see it.

1
  • 1
    I don't want it to sign with a contract. I want to pass in already signed data and send transactions on behalf of a user
    – JustinZ
    Commented Feb 12, 2019 at 10:02

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.