0

I want to create an Ethereum wallet, and I need an address and a private key, but I am unable to generate both. Please suggest a way to generate key pairs.

1

Creating a new account with JSON RPC makes the client handle the keystore. Usually it's saved in a .json file locally.

Check this question about how to create a new account, but note that the private key will not be returned.

How can I make new account by JSON-RPC?

If you want to create a wallet and have access to the private key, the go-ethereum client might be useful. Use the libraries directly and generate your own wallets.

For example import the crypto library

import "github.com/ethereum/go-ethereum/crypto"

And generate your account

key, err := crypto.GenerateKey()

To get the private key do

hex.EncodeToString(key.D.Bytes())
1

In order to generate address and private key in Node.js/javascript you can use web3-eth-accounts package

const Accounts = require('web3-eth-accounts');

const accounts = new Accounts('http://localhost:8545');
const { address, privateKey } = accounts.create();

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.