1

I have 10s of private and public keys associated with 10s of different addresses.

Now I have a test-net btc address "mfoxBS2TpoiUWrEV3sZopoEB6Pi2d7TE9N".

What operations can I perform to find the appropriate Public Key associated with given address?

UPDATE I am not trying to find out reverse scenario of fetching a public key from address.

As I already have bunch of public keys. One of them have created the given address. And I just want to figure out which one is it from the whole bunch?

Maroon5
  • 55
  • 7

2 Answers2

1

There is a step-by-step guide here and you can also test it on this site.

You can also use this python library.

import os
os.environ['CRYPTOTOOLS_NETWORK'] = 'test'

from btctools import PublicKey

>>> pub = Publickey.from_hex('yourpubkeyhere')
>>> pub.to_address('P2PKH')
'mp9CpH3h25m7FZqsPBf2UfU9Gm4u41j9Eg'
Mike D
  • 3,569
  • 1
  • 9
  • 19
  • Is there any way I can do this check by Java program or using Api? – Maroon5 Sep 11 '18 at 11:21
  • There is a java library call bitcoinj that might be able to do this. Also there is this: https://bitcore.io/playground/#/address but I wouldn't trust any online service with a private key. It might be good enough for testnet though. – Mike D Sep 11 '18 at 12:17
0

Your only option is to derive the address from each public key, and compare it with the address you have.

Raghav Sood
  • 17,027
  • 3
  • 22
  • 43