Obtaining a Signed Transaction from MetaMask without Submitting it to the Blockchain

Hello, MetaMask community!

I’m working on a project where I need to obtain a signed transaction from MetaMask without immediately submitting it to the blockchain. I want to use this signed transaction to perform additional operations on my backend server before submitting it to the blockchain network.

Here’s a high-level overview:

  1. A user initiates a specific action on my web application that requires interaction with a smart contract on the Ethereum blockchain.
  2. I want to provide a seamless experience by using MetaMask to sign the transaction on the user’s end.
  3. Instead of directly submitting the signed transaction to the blockchain, I would like to retrieve the signed transaction object and send it securely to my backend server.

I aim to avoid exposing the private key or performing sensitive operations on the client side. I’ve explored the web3.js and ethers.js libraries but couldn’t find a straightforward solution to achieve this workflow.

Could you please guide me on obtaining a signed transaction object from MetaMask without immediately submitting it to the blockchain? Any code examples or suggestions on the best practices to accomplish this would be greatly appreciated.

Thank you in advance for your help!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.