Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: krack-r on April 15, 2017, 04:09:04 PM



Title: Question - Is there a way to programmatically check if wallet exists in chain
Post by: krack-r on April 15, 2017, 04:09:04 PM
Hi guys,

Sorry for the dumb question but I am writing a software and I am wondering if there is a way in C# or Java to check if a wallet exists in the Network already, or the date of creation of a wallet?

Thanks in advance.


Title: Re: Question - Is there a way to programmatically check if wallet exists in chain
Post by: achow101 on April 15, 2017, 04:21:27 PM
If by wallet you mean address, then yes, partially. Technically all addresses that can every exist already exist; there is no need to register that you own an address or anything of that sort. To the Bitcoin network and blockchain, your address is just a hash in the output script of a transaction and that that hash must match the hash of the public key or redeemscript that you provide when spending from the output. So technically, addresses don't matter and are pretty much irrelevant to the blockchain.

You can check to see if an address was previously used by scanning the entire blockchain for transactions which have the same output that the address specifies. However you cannot know whether someone has already created an address but never used it. You also don't know when an address was created because it could be created long before it is actually first used.


Title: Re: Question - Is there a way to programmatically check if wallet exists in chain
Post by: krack-r on April 15, 2017, 05:52:35 PM
If by wallet you mean address, then yes, partially. Technically all addresses that can every exist already exist; there is no need to register that you own an address or anything of that sort. To the Bitcoin network and blockchain, your address is just a hash in the output script of a transaction and that that hash must match the hash of the public key or redeemscript that you provide when spending from the output. So technically, addresses don't matter and are pretty much irrelevant to the blockchain.

You can check to see if an address was previously used by scanning the entire blockchain for transactions which have the same output that the address specifies. However you cannot know whether someone has already created an address but never used it. You also don't know when an address was created because it could be created long before it is actually first used.

Thanks a lot for the reply. I will figure something out about the scanning of the blockchain.