I am using this to get public key:


I am in need of to get the public and private key using PHP web3 like this:


How can I do that?

  • Do you want to generate a random pair of private key / public address? (I wrote public address, since the public key is not really useful for anything in Ethereum). – goodvibration May 21 '19 at 9:48
  • Even issue is opened on github, but no reply. github.com/sc0Vu/web3.php/issues/151 – Kamran Jabbar May 21 '19 at 9:48
  • Actually, according to requirements, I am building an API in which if user generate the wallet that should create public and private key automatically instead of manually from myetherwallet. – Kamran Jabbar May 21 '19 at 9:49
  • So can you please answer my question more accurately? Are you looking to generate an account yourself instead of relying on (for example) MyEtherWallet? – goodvibration May 21 '19 at 9:50
  • @goodvibration yes and that should work on etherscan smart contract like if someone generate that (wallet) and want to access some functions of smart cotnract that should work. – Kamran Jabbar May 21 '19 at 9:58

The eth-accounts module in web3.js is in memory operation, the account was created in memory, and you can signed transaction by account.

If you want to create account in memory, web3.php doesn't support this now.

If you want to create account in your geth/parity node, you can use personal module.

Also I'm working on this ethereum-wallet (https://github.com/web3p/ethereum-wallet), it might help you when I finish.

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.