I create raw transaction and sign with owner privatekey to send transaction. For now, owner privateKey is just simply stored to variable but this is not safety so I want to encrypt or decrypt the owner privateKey in my javascript code. I'm also wondering that the way of get owner PrivateKey safely in my client code not to expose in plain text or binary or everything hacker can recognize. Is there a function supported by WEB3 right now? How do you guys dealing with this problem if someone who's developing a service like me?

I know this is not a technical question but I want to get an idea how to access it. Thanks.


Private keys are never meant to be stored in javascript, not even encrypted. Web3 allows you to call sendTransaction, which requires a node with an unlocked account. This way, your provider (injected metamask/web3 browser) will sign the request. It keeps private keys out of your javascript and out of reach of any potential hacker.

| improve this answer | |
  • You mean that I can run the node with unlocked (owner) account locally using Go-ethereum (geth)? And then, It's possible to do sendTransaction on my client code (javascript) without signing by owner's private key? For the last, I'm testing on the Ropsten testnet for demo which some users have to make transactions on their app. It seems impossible to sign transaction on every other clients' apps. – rachel_hong Apr 16 '18 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.