0

I am developing an application where the front-end does not talk directly to the blockchain. Back-end does that instead, due to some proccesses that can only be done in the back-end (file manipulation, for example). The idea is that users will "login" using metamask in the front-end and then back-end will handle all the communication with the blockchain in behavior of the user.

Since it's just a portfolio project, I am currently using a wallet of my own to cover the costs, with test ether in a testnet. But I know it's kinda ugly.

Question: is there a way to pop that metamask confirmation window to the user, whenever back-end performs a transaction? So that user's wallet will be charged, and not the "back-end's wallet".

I am currently using ethers.js, react in the front-end and nodejs in the back-end. I know it's odd, but if anyone has accomplished that, I would be really happy to hear how!

1 Answer 1

0

Yes, of course!

Read MetaMask guide on how to have your frontend interact with MetaMask so it allows the user to sign transactions. Your frontend then sends the signed tx to backend, which transmits it to the blockchain.

2
  • So in this case I could: build the transaction in the backend > return to the frontend > ask user to sign it > send it signed back to the backend > send to eth network. Sounds correct? Commented May 4, 2022 at 13:38
  • Yes, sounds right.
    – Kof
    Commented May 4, 2022 at 15:03

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.