1

With web3js v1.0.0 you can create accounts with web3.eth.accounts.create(); and access the public address and private key with newWallet.address and newWallet.privateKey.

How can you do this with web3j or web3Swift.

The documentation is difficult to find this in.

Thanks for any help.

  • Did you solve it? Is my answer helps? – skywinder Jun 13 at 6:49
0

Here we go, by using web3swift library:

Create Account

    // Create keystore and account with password.    
    let keystore = try! EthereumKeystoreV3(password: "changeme"); // generates a private key internally if node "privateKey" parameter supplied
    let account = keystore!.addresses![0]
    print(account)

We are also working on unification of the API format. I already open issue to cover your need in the quesiton: https://github.com/matterinc/web3swift/issues/40

Here a usage example for the next major update of the library:

newWallet = web3.eth.accounts.create() 
// access the public address 
newWallet.address
//private key:
newWallet.privateKey

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.