7

I'm trying to make a signed transaction in browser with web3 injected from metamask and send the transaction to my backend-server and then submit it to blockchain.

However, it's hard to find how I can just sign transaction(not sending it) and send it to my backend server.

Thanks for help

3
  • Can you share more why you want to do so? Generally, once signed you cannot change it anyway.
    – turboza
    Jul 27, 2021 at 12:00
  • @TurboPanumarch Probably he wants to pay the gas fees for the user
    – BonisTech
    Feb 10, 2022 at 22:48
  • Any solution ? I want to do same thing over android mobile wallet
    – Jay Vyas
    Apr 22, 2022 at 7:14

2 Answers 2

2

You can refer the below for signing data from metamask,

https://docs.metamask.io/guide/signing-data.html#signing-data-with-metamask https://github.com/danfinlay/js-eth-personal-sign-examples

1
  • 6
    Thanks but I'v already read it and it's about signing data not transaction.
    – fd asdf
    Jul 28, 2021 at 1:54
2

Yes, it is possible to sign transactions in the browser and send them to your backend server.

The web3.js library provides a method called eth_signTransaction which will allow you to sign the transaction and generate a signature.

You can then send the signed transaction to your backend server which can submit it to the blockchain.

1

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.