How to confirm that given bitcoin address is generated by given public key?

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

Posted 2018-09-11T10:05:01.587

Reputation: 45

it's not duplicate. updated my question description.Maroon5 2018-09-11T10:38:35.177

Answers

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

Posted 2018-09-11T10:05:01.587

Reputation: 1 571

Is there any way I can do this check by Java program or using Api?Maroon5 2018-09-11T11:21:55.987

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 2018-09-11T12:17:28.827

0

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

Raghav Sood

Posted 2018-09-11T10:05:01.587

Reputation: 10 897