I am making a desktop dapp using Ethereum, web3.js, truffle, electron, and react. This will be a ethereum private blockchain.

I can make, compile, deploy, call, transact, on testRPC using the testRPCs default accounts.

I want to discuss on the best possible ways for Key management in a Desktop ethereum app.

Questions I have are:

1, How to create new accounts?

2, Once account is created how to get Public and private key and where to save them?

Constraint : Cannot use any third party tools like Mist or metamask.

Anybody please help in designing this?


So if you say that you are using web3js I am assuming that you don't want to start a local node to connect to the blockchain but use a remote node for doing that stuff.

In this case you would need to just create an account locally and use that to interact with the blockchain.

If you use web3-v1.0 I would suggest to have a look at following: http://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#create

They explain quite nicely how to achieve exactly what you want to do.

For web3-v0.2xxx I believe that you will need to use some other library to achieve creating/storing keys. I am using the following in an application and it works flawlessly:


I am not an expert with electron but since your application is native you should be able to just store the key pairs in your application in both cases.

| improve this answer | |
  • I am trying to come out of TestRPC/Ganache as it does not let me use Web3@1. I ran a geth instance on AWS but there also I see web3 version as " > web3.version { api: "0.20.1", ethereum: "0x3f", network: "1", node: "Geth/v1.8.7-stable-66432f38/linux-amd64/go1.10", whisper: undefined, getEthereum: function(callback), getNetwork: function(callback), getNode: function(callback), getWhisper: function(callback) }" Any ideas how to update this? – Manish May 4 '18 at 7:36
  • Thanks @Kai , I googled a bit more about web3@1.xxx, and there are a lot of standing issues with that, So I will go with you eth-lightwallet solution. Thanks for help. – Manish May 4 '18 at 7:47
  • You're welcome! Regarding your question with web3@1.0 : This is not related to TestRpc/Ganache or your Geth node, but to truffle. Truffle uses version 0.2xx of web3. So to come arround this you would need to get rid off truffle and only use web3@1.0 for interacting with your node. – Kai Kälberer May 4 '18 at 7:53
  • Ohh It seems like I was not clear, Sorry.I understand that I have to leave truffle to use Web3@1.0. So to achieve that I ran a new geth instance on AWS EC2, so now when I checked the web3 version on geth node it shows {web3.version { api: "0.20.1", ethereum: "0x3f", network: "1", node: "Geth/v1.8.7-stable-66432f38/linux-amd64/go1.10", whisper: undefined, getEthereum: function(callback), getNetwork: function(callback), getNode: function(callback), getWhisper: function(callback) }} I am not sure will this affect my calls from my front end where I am using web3@1.0 – Manish May 4 '18 at 13:36

Depends on whether you want to deploy ethereum public blockchain network or private blockchain network.

If you deploy your application on public blockchain network then all the users of of public ethereum blockchain would be able to access it.

If you deploy your application on private ethreum blockchain network then you can create new account using personal.newAccount() command ongethconsole.tsstRPC is a testing environment and geth is production environment.

You can see addresses of all accounts using eth.accounts command. Read more about geth account management here.

As private keys are the only way to access your ethereum account .You shall not share it in any public repository or cloud as any one can access that account and transfer ether from respective account to any account.

Following link provides more information about how to manage accounts using ethers.js library. Wallets to manage keys to prove ownership in ethereum network

| improve this answer | |

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.