Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: AniketBhadane on June 30, 2017, 06:20:05 PM



Title: How does a wallet come to know of Address just by importing Private key?
Post by: AniketBhadane on June 30, 2017, 06:20:05 PM
I have exported my Private key to Paper Wallet. Now, when we send/receive bitcoins, we send/receive them to an "Address". So suppose I receive some bitcoins on my address. I have the private key of this address. Now I want to spend the bitcoins I received at my address. For this I need to import my private key to some wallet. Am I right?

And even though I'm importing my private key to the wallet, how will the wallet know what is my "Address"? Because I'm just importing the Private key, not address. Is address derived from private key?

I'm confused with this.


Title: Re: How does a wallet come to know of Address just by importing Private key?
Post by: unamis76 on June 30, 2017, 06:25:33 PM
It knows because one key can only correspond to one address, so to speak. I'm not sure why exactly you're confused, as you seem to get things pretty much right.

You might want to read more here (https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses)


Title: Re: How does a wallet come to know of Address just by importing Private key?
Post by: jonald_fyookball on June 30, 2017, 06:30:43 PM
I have exported my Private key to Paper Wallet. Now, when we send/receive bitcoins, we send/receive them to an "Address". So suppose I receive some bitcoins on my address. I have the private key of this address. Now I want to spend the bitcoins I received at my address. For this I need to import my private key to some wallet. Am I right?

And even though I'm importing my private key to the wallet, how will the wallet know what is my "Address"? Because I'm just importing the Private key, not address. Is address derived from private key?

I'm confused with this.

Yes, exactly right: The address is derived from the private key. 

https://bitcoin.stackexchange.com/questions/1851/how-to-generate-a-valid-bitcoin-address-for-destroying-bitcoins


Title: Re: How does a wallet come to know of Address just by importing Private key?
Post by: Wendigo on June 30, 2017, 06:49:21 PM
Let's say you have a car. Let's pretend that your car is also your public address. Your car is visible to everyone and everyone knows it's your car (Public key). You have a key for your car. Your car key is also your Private key. Your key is designed only for your car and it doesn't fit other keyholes. So every time you import your keys to a new wallet your car is signaled that it's you the owner and you can enter your car freely. And yes the public keys are derived from the private keys and the signaling happens automatically so your new wallet knows your previous address with the old balance ( or your car so to speak).

Found this explanation:

Quote
Every public key is 256 bits long — sorry, this is mathematical stuff — and the final hash (your wallet address) is 160 bits long. The public key is used to ensure you are the owner of an address that can receive funds. The public key is also mathematically derived from your private key, but using reverse mathematics to derive the private key would take the world’s most powerful supercomputer many trillion years to crack.

And here also:  https://blog.wetrust.io/why-do-i-need-a-public-and-private-key-on-the-blockchain-c2ea74a69e76


Title: Re: How does a wallet come to know of Address just by importing Private key?
Post by: Jamie Oliver on July 13, 2017, 06:32:49 AM
This article may be too technical for some users. The more basic article on Bitcoin Addresses may be more appropriate.
A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. Using public-key cryptography, you can "sign" data with your private key and anyone who knows your public key can verify that the signature is valid.
A new keypair is generated for each receiving address (with newer HD wallets, this is done deterministically). The public key and their associated private keys (or the seed needed to generate them) are stored in the wallet data file. This is the only file users should need to backup. A "send" transaction to a specific Bitcoin address requires that the corresponding wallet knows the private key implementing it. This has the implication that if you create an address and receive coins to that address, then restore the wallet from an earlier backup, before the address was generated, then the coins received with that address are lost; this is not an issue for HD wallets where all addresses are generated from a single seed. Addresses are added to an address key pool prior to being used for receiving coins. If you lose your wallet entirely, all of your coins are lost and can never be recovered.
Bitcoin allows you to create as many addresses as you want, and use a new one for every transaction. There is no "master address": the "Your Bitcoin address" area in some wallet UIs has no special importance. It's only there for your convenience, and it should change automatically when used.