I want to send signTransaction using web3, the problem is that for doing that, I need to use the privateKey of my Metamask account. Anyone could see the "privatekey" from explorer.
So how can I hide this variable in javascript for using it safety? The line of code in javascript in frontend is the following:
web3.eth.accounts.signTransaction(rawTransaction, privateKey)
I would like to store the privatekey in backend and make a call to backend to obtain it, how should I do it in a safety way?
Thanks in advance.
You are using blockchain wrong.
Make users to sign the transaction with their own private key. Furthermore MetaMask never exposes the private key in the browser in the first place.