1

When I create a new account as follows :

web3.eth.personal.newAccount('pass').then(console.log);

-> pass is account password.

Then, I receive an account as follows :

0x15CaFbd23DEB631447D34de50e961B0049f4Df2B

Is this my public key ? And if so, How can I see my private key ?

Meanwhile, sometimes when I sent a transaction, I need to unlock my account by account password via ParityUI. Why do I need to do this only sometimes ?

And if I create an account without password as follows, what happens ?

web3.eth.personal.newAccount().then(console.log);
1

When I create a new account as follows :

web3.eth.personal.newAccount('pass').then(console.log);

-> pass is account password.

Then, I receive an account as follows :

0x15CaFbd23DEB631447D34de50e961B0049f4Df2B

Is this my public key ? And if so, How can I see my private key ?

Yes, that is your public key. The private key is saved in a keyfile that is encrypted and can be opened with the password you used to create the account. The private key can be recovered with keyethereum:

privateKey = keythereum.recover(password, keyObject);

Meanwhile, sometimes when I sent a transaction, I need to unlock my account by account password via ParityUI. Why do I need to do this only sometimes ?

This is because the account gets unlocked only for a period of time, when this expires, for security, you need to unlock again.

And if I create an account without password as follows, what happens ? web3.eth.personal.newAccount().then(console.log);

This should produce an error because the password is required to open the keyfile.

  • Thank you. Just concerning when I unlock my account using account password: Logically in Ethereum and Bitcoin we sign our transaction using our private key, isn't it ? But in this case we use our password similar to IOTA public ledger . I'm wrong ? Thanks – Questioner May 28 '18 at 13:47
  • In ethereum you use your private key, but this is transparent to the user. Geth will use your password to access the key file and then use the private key to sign the transaction. You can actually do this manually. Once you get the private key, you can use web3 functions to sign transaction by yourself, if you are curious you can take a look at the examples here – Jaime May 28 '18 at 14:05
  • Thank you. Just I appreciate if you mention related link in which I could find these commands to sign transaction direcly by private key. Btw, I think you mean : "but this is NOT transparent to the user", isn't it ? Thanks again – Questioner May 28 '18 at 14:10
  • By transparent I mean you do not have to do it yourself, geth will do it if you unlock your account. The links are in my previous comment at the end where it says "here". – Jaime May 28 '18 at 14:37

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.