0

I have a problem, What I want is to user to come at my website, from where he/she can connect to its metamask wallet account, after connecting I want them to allow to do transaction from some specific token address, to admin metamask account, but for transaction we require a private key of a customer's account.

In that case how I will get customer's private key to perform a transaction ? or if there any other way arounf through which I can achieve my requirement, kindly guide me to some solution.

1
  • I would just say, gonon Metamask website and read the doc if you have no idea how blochain works. Commented Jan 21, 2022 at 13:41

2 Answers 2

2

Metamask doesn't expose private keys as it's a huge security issue. You shouldn't expect users to expose their private keys either. If you want to sign a transaction or arbitrary data, you can use the Metamask RPC methods. You can find the methods here. With this, you can perform data signing, encryption-decryption with the private keys, in a safe way.

0

After user connected the metamask wallet, you can send token to admin account without signing the transaction. So you don't need private key of the user. Try this method web3.eth.sendTransaction

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.