Bitcoin Forum
November 09, 2024, 07:16:19 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Key generation  (Read 526 times)
Flowency (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
September 04, 2017, 01:15:56 PM
 #1

Hey everybody!

I started reading about Bitcoin this weekend and I've got 2 open questions before daring the step to invest money into it.

I've read about the different kind of wallets and since I only want to invest I'd be interested in an offline created paper wallet for cold storage. Now I've followed the steps on Bitcoins page with saving the key generator to my pc, going offline and well generating the key but I wondered: in theory isn't it possible that somehow somebody randomly generates the exact same private key I just did and thus gets access to my Bitcoins that are already linked to my private key? I know the chance is extremely low with 1 to 10^77 but still. Is it possible?

Another question I've got is, when I'm ready to spend my Bitcoins I'll link my private key to an online wallet right? A file will be created on my pc which I should always keep on an external device, encrypted and secured by a password. If I lose said external device or it breaks down shouldn't I still be able to acces my savings if I still have my private key? The one thing i definetly learned is, that I should never tell anyone my private key because if I do they can access my Bitcoins. But when they can shouldnt I be able to do so too even if I lose my wallet file?

Perhabs I've got some really heavy misconceptions with the whole concept of cryptocurrency and I just wanted to clarify them. I hope someone can help me with this Smiley

Thanks and cheers!
Florens
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
September 04, 2017, 01:29:48 PM
 #2

Hey everybody!

I started reading about Bitcoin this weekend and I've got 2 open questions before daring the step to invest money into it.

I've read about the different kind of wallets and since I only want to invest I'd be interested in an offline created paper wallet for cold storage. Now I've followed the steps on Bitcoins page with saving the key generator to my pc, going offline and well generating the key but I wondered: in theory isn't it possible that somehow somebody randomly generates the exact same private key I just did and thus gets access to my Bitcoins that are already linked to my private key? I know the chance is extremely low with 1 to 10^77 but still. Is it possible?

Another question I've got is, when I'm ready to spend my Bitcoins I'll link my private key to an online wallet right? A file will be created on my pc which I should always keep on an external device, encrypted and secured by a password. If I lose said external device or it breaks down shouldn't I still be able to acces my savings if I still have my private key? The one thing i definetly learned is, that I should never tell anyone my private key because if I do they can access my Bitcoins. But when they can shouldnt I be able to do so too even if I lose my wallet file?

Perhabs I've got some really heavy misconceptions with the whole concept of cryptocurrency and I just wanted to clarify them. I hope someone can help me with this Smiley

Thanks and cheers!
Florens

Quote

First thing is you misunderstand what private keys, public keys and addresses are. So let's clear that up first.

Private keys are 256bit random numbers. Private keys are never made public. They remain secret.

Public keys are derived from private keys and are mathematically related to them. You can't derive a private key from a public key. Each private key has just one public key. They are called a key pair. The public key is revealed to the world and the world uses it to verify transaction signatures generated by your secret private key without you having to expose said private key to the world. Bitcoin public keys are also 256bits.

Hash functions - Hash functions take arbitrary sized data and output numbers of a fixed size. They are one way functions. You can't take the output of a hash function and determine the input. Hash functions are used to create "fingerprints" of data. If even a single bit in the data changes the output of the hash function will change.

Bitcoin addresses are public keys run through hash functions. The hash functions used result in 160bit addresses.

Because 256bits is greater than 160bits all addresses can be unlocked by more than one public/private key pair. That's where the 296 comes from. But this refers to key pairs behind bitcoin addresses not private keys behind public keys. An address is not the same as a public key. It is the public key run through hash functions.

There is such a thing as a deterministic wallet and that uses a single random number to generate a whole tree of addresses. We don't call that random number a private key though. We call it a seed. Each address there has its own private key and they are indistinguishable from randomly generated keys to anyone who doesn't have the seed.


Quote
Addresses are derived from the 160-bit hash of the public key. Public key, used by network participants for verifying your signed transactions, is a 256-bit number.

Thus, there are many public keys (and corresponding private keys) that would match any given address.

This is called "hash collision" - a well studied, mostly theoretical concept.

The probability of this happening is astronomically small. The smallness of it is hard to express in words and to grasp intuitively.

Also see https://www.reddit.com/r/Bitcoin/comments/1w1ipk/odds_the_same_private_key_will_be_generated_twice/

This is from a reddit post. Yes, it is possible, but the chances are so small, you are more likely to be hit be an airplane.

And yes. As long as you have your private key, even if your system somewhere fails, you will be able to import the private key in a wallet like electrum, and thus access your keys.

See http://docs.electrum.org/en/latest/faq.html#can-i-sweep-private-keys-from-other-bitcoin-clients

More detailed, http://www.thecleverest.com/importing-bitcoin-from-a-paper-wallet-into-electrum/

But, with the private key, you can only recover the bitcoins on that adress, therefore it is better to also write down and remember the seed of your wallet.

Quote
Even though the private keys are generated from the same seed, you cannot derive the other private keys from it. It is however possible if you do have the master public key of wallet.


Velkro
Legendary
*
Offline Offline

Activity: 2296
Merit: 1014



View Profile
September 04, 2017, 03:04:00 PM
 #3

randomly generates the exact same private key I just did

In theory possible, in practice not really. I see u are treating security at most respect so to be totally safe, keep ur funds spread across several addresses.
Problem solved.


Another question I've got is, when I'm ready to spend my Bitcoins I'll link my private key to an online wallet right?

Its not needed, you can sign offline transaction with your private key and only push TX without revealing ur private key, through services that offer this..
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
September 05, 2017, 10:44:36 AM
 #4

in theory isn't it possible that somehow somebody randomly generates the exact same private key I just did and thus gets access to my Bitcoins that are already linked to my private key? I know the chance is extremely low with 1 to 10^77 but still. Is it possible?

It is possible. It is also possible that you fall through the floor due to quantum tunneling. Everything is possible, but these two things are highly improbable.

Another question I've got is, when I'm ready to spend my Bitcoins I'll link my private key to an online wallet right?

No. Your private key should be always private and is always linked to your public key with mathematical properties. This public key is unknown to others until you spend some of your coins, then a public key of your Bitcoin address where you spent your coins from will be shown to the world, this has no effect on anything, unless quantum computers become powerful enough to find the private key based on the public key. Btw, an online wallet is just a website where they offer to keep your bitcoins for you and hold your private keys. You never need to use it and for security reasons, you shouldn't.


A file will be created on my pc which I should always keep on an external device, encrypted and secured by a password. If I lose said external device or it breaks down shouldn't I still be able to acces my savings if I still have my private key? The one thing i definetly learned is, that I should never tell anyone my private key because if I do they can access my Bitcoins. But when they can shouldnt I be able to do so too even if I lose my wallet file?

You don't need to keep that file (wallet file). You can just delete it if you still have the private keys. Anyone who has a private key can spend the funds, so yes, you both have the control of it if you both have the private keys, but the one who spends them first gets the money. You understand that if someone knows your private key, your funds could be gone in a couple of minutes with no way of getting them back? So it is pointless that you still have access to it, since the funds will be gone instantly.
aplistir
Full Member
***
Offline Offline

Activity: 378
Merit: 197



View Profile
September 07, 2017, 09:34:24 AM
 #5

Quote
You don't need to keep that file (wallet file). You can just delete it if you still have the private keys. Anyone who has a private key can spend the funds, so yes, you both have the control of it if you both have the private keys, but the one who spends them first gets the money. You understand that if someone knows your private key, your funds could be gone in a couple of minutes with no way of getting them back? So it is pointless that you still have access to it, since the funds will be gone instantly.

Well, actually you do need to save that file or your wallet passpharese too.
Paper wallets can be a little dangerous for people who do not understand how Bitcoin works.

Many wallet  programs like Electrum transfer all your coins from your current address (paper wallet) to a new address whenever you transfer any coins away from your current address.
After that happens your paper wallet will be empty and the only place your new private keys are, is in your wallet file. And if you delete that, then you do not own bitcoins any longer... It has happened.

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
ranochigo
Legendary
*
Offline Offline

Activity: 3038
Merit: 4420


Crypto Swap Exchange


View Profile
September 07, 2017, 10:23:26 AM
 #6

Many wallet  programs like Electrum transfer all your coins from your current address (paper wallet) to a new address whenever you transfer any coins away from your current address.
After that happens your paper wallet will be empty and the only place your new private keys are, is in your wallet file. And if you delete that, then you do not own bitcoins any longer... It has happened.
Though there is no downside to backing up a wallet file, the wallet doesn't always send the change to a new address, depending on your settings. If you're using Electrum and import your keys, it will only send the change back into the origin address. This was a feature that was introduced to prevent the scenario that you're described.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
aplistir
Full Member
***
Offline Offline

Activity: 378
Merit: 197



View Profile
September 07, 2017, 10:26:28 AM
 #7

Though there is no downside to backing up a wallet file, the wallet doesn't always send the change to a new address, depending on your settings. If you're using Electrum and import your keys, it will only send the change back into the origin address. This was a feature that was introduced to prevent the scenario that you're described.

Wow. I did not know that was fixed!. Thanks for the info   Cheesy

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!