3

How can I create a base58 private key and public key in Java? I'm pretty familiar with Java and I have the bitcoinj-minimal code, but it's not clear to me how I can generate a base58 key pair from the code.

Murch
  • 71,155
  • 33
  • 180
  • 600
simmi
  • 31
  • 2

1 Answers1

2
com.google.bitcoin.core.ECKey key = new com.google.bitcoin.core.ECKey(); // keypair
byte[] pub = key.getPublicKey(); // byte array

String prv; 
prv = key.getPrivateKeyEncoded(com.google.bitcoin.core.NetworkParameters.prodNet());
Jus12
  • 1,365
  • 1
  • 14
  • 24