1

I want to create a new account using web3.js < v1.0

In web3.js 1.0.x we have this method:

web3.eth.accounts.create();

or at least this method:

web3.eth.accounts.privateKeyToAccount(myPrivateKey);

But unfortunately I didn't any equivalent method in web3.js v0.x

Do you know any way to create a new account in web3.js v0.x?

P.S: this topic (Creating an account using web3js or web3j) is about this subject, but it doesn't contain any correct alternative solution.

1

You could enable personal API so you can access it via JSON RPC and let the node create the account, but web3 0.x doesn't have the web3.personal object. You would need to make the JSON RPC call directly. "See How can I make new account by JSON-RPC?".

Alternatively, you can create the account locally using a library like ethereumjs-wallet. In this case you would also need something like ethereumjs-tx to sign the transactions locally.

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.