1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding an external key pair to a local bitcoinj wallet

Discussion in 'Finance' started by user3222, Oct 8, 2018.

  1. user3222

    user3222 Guest

    I need to add a vanity address to a local wallet that I maintain using bitcoinj APIs. I'm not able to search for the vanity using bitcoinj APIs directly, on my local PC, because my vanity is too fancy. However, I'm able to generate the pair online easily. What is the API I should use to add this key pair to my local wallet ?

    I tried the following,

    Say the required vanity is 1meowvYmB7ughhsRvUWfsac9LKDonh4cn (private key: 5JXFsJEAiqtTv95rSmw3KSJeAZ97SsmKWTQq5yqBzioSJ1guUHK). I generated this at bitcoinvanitygen, I converted this to hex at, Base58 Encode, Decode, and Validate. I tried the following.

    Address vanity = new Address(networkParameters, networkParameters.getAddressHeader(), Hex.decode("000871DD31D517D15D7352139A44B07EBE97B1772C7F291357"));

    I need to construct an Address from this string. I get the following error:

    exception decoding Hex string: String index out of range: 47

    Login To add answer/comment

Share This Page