Pages:
Author

Topic: I am lost in bitcoin wallet and private key (Read 3830 times)

hero member
Activity: 619
Merit: 500
April 09, 2014, 09:31:25 AM
#48
You guys are just making what is quite simple complicated and confusing with these explanations  Cheesy.

+1.
All those explanations are pretty much correct, but I don't think an ordinary user (esp. a new bitcoiner) need to understand that much.
full member
Activity: 280
Merit: 100
All you need is to backup the .wallet or .dat file inside your %AppData%\CoinFolder

or ~/.coinfolder/ if linux

global moderator
Activity: 3990
Merit: 2717
Join the world-leading crypto sportsbook NOW!
You guys are just making what is quite simple complicated and confusing with these explanations  Cheesy.
sgk
legendary
Activity: 1470
Merit: 1002
!! HODL !!
Ok you got me lost, you are way way smarter than me!

I sent John 10 BTC, John received them,
an output from my wallet was created, an input for John's wallet created.
John has now 10 BTC,
now John spent 3 BTC at amazon, an output of 3 BTC for John, an input of 3 BTC for Amazon

BUT I think you are saying my example of (John and Amazon) is wrong when you say partial output,
if I am not mistaken: you are saying that the whole BTCs in the wallet create an output even if you spend only part of them? like when John spent 3 BTC on Amazon from that 10 BTC, it means: an output of 3 BTC created to amazong and another output for 7 BTC created to John (output of his own money to his own wallet)?


Not the whole wallet balance has to go out, only the BTC you received in a single transaction.


Think of it this way:

Someone gives you a $50 bill and a $20 bill. Now your pocket has $70. (That makes 2 incoming transactions for you)

You now need to give $40 to James Bond. What you will do is take out the $50 bill (from a single incoming transaction) and will split it into 2 bills: a $40 bill and a $10 bill. The $40 bill will be spent in the outgoing transaction and the $10 bill becomes the incoming transaction for you, which goes back into your pocket. You now have $30, which comprises of one $20 bill and one $10 bill.

The $10 bill becomes the incoming transaction for James Bond.

If James Bond needs to spend an amount smaller than $10, he will also go into the same process as you did.

Now think of the whole process again by replacing 'pocket' with 'wallet' and 'dollar bill' with 'Bitcoin'
global moderator
Activity: 3990
Merit: 2717
Join the world-leading crypto sportsbook NOW!
Why is this particular instance such an issue? The chances of this happening are astronomical.

It is not an issue, but I like to understand how things work.
Simply put: Would you go buy a car if you don't know how to drive?

I think a more apt analogy would be going to buy a car and asking the dealer how a combustion engine works and what are the odds of it blowing up and killing you. Cheesy
newbie
Activity: 42
Merit: 0
Why is this particular instance such an issue? The chances of this happening are astronomical.

It is not an issue, but I like to understand how things work.
Simply put: Would you go buy a car if you don't know how to drive?
hero member
Activity: 525
Merit: 500
Why is this particular instance such an issue? The chances of this happening are astronomical.
newbie
Activity: 42
Merit: 0
Ok I got that part, both of them will get the payment,
BUT both of them are able to spend it too. REASON: I send the bitcoin to an address, has nothing to do with private key.
John Address is : AAAAA
Sarah Address is: AAAAA

so both open their wallets, they see 10 bitcoins I sent

Even if they have different private keys, since I sent it to an address and not a private key, then the transaction will show on both and both are able to spend it, just a matter of who spend it faster!


This part is correct.

Now John will spend 3 bitcoins.
Then it will show both of them have 7 Bitcoins left.
Then Sarah will spend 5 bitcoins.
Then it will show both of them have 2 bitcoin left.


Just a side note, when bitcoin are spent, you can't use a transaction output partially.
So, if John want to send CrapMan 3 BTC with a piece of "10 BTC" on his address, he need to create a transaction with that 10 btc as input, a output of "3 btc" to address 1 (controlled by CrapMan) and a output of "7 btc" to address 2 (controlled by John).

For most wallets software, by default, the wallet will generate a new change address every time to improve anonymity.
So, after John spend 3 btc, the common addresses held by John and Sarah will have nothing on it.

FYR: https://en.bitcoin.it/wiki/Change

Ok you got me lost, you are way way smarter than me!

I sent John 10 BTC, John received them,
an output from my wallet was created, an input for John's wallet created.
John has now 10 BTC,
now John spent 3 BTC at amazon, an output of 3 BTC for John, an input of 3 BTC for Amazon

BUT I think you are saying my example of (John and Amazon) is wrong when you say partial output,
if I am not mistaken: you are saying that the whole BTCs in the wallet create an output even if you spend only part of them? like when John spent 3 BTC on Amazon from that 10 BTC, it means: an output of 3 BTC created to amazong and another output for 7 BTC created to John (output of his own money to his own wallet)?
hero member
Activity: 543
Merit: 500
Let me quote this again.

https://en.bitcoin.it/wiki/Weaknesses#Generating_tons_of_addresses
Quote
Generating tons of addresses

Generating an address doesn't touch the network at all. You'd only be wasting your CPU resources and disk space.

Also, a collision is highly unlikely.

Keys are 256 bit in length and are hashed in a 160 bit address.(2^160th power) Divide it by the world population and you have about 215,000,000,000,000,000,000,000,000,000,000,000,000 addresses per capita.(2.15 x 10^38)[1]

So, even if you generate millions, billions or trillions of addresses, the chance of having address collision is still ridiculously low. Cheesy

Edit: I got to go now, but I am sure there are lots of people here ready and happy to answer your questions Cheesy
hero member
Activity: 1008
Merit: 515

What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?



That would be decided on by the miners. Once an address is in the network a new one will not be created the same.

Not really.
You never "announce" your address to the network, and there is no one doing the checking at all.
In fact, there are many ways you can generate your address offline easily.


Ops! now all someone has to do is: download the wallet Client, and make millions of wallets and he might get lucky, specially with all the the huge exchanges and transactions around the world right now and people moving Bitcoins in and out creating different wallets ...etc

A bitcoin address starts with a 1, followed by 33 random characters. There are 62 possible characters.

So the maximum amount of addresses is 33^62
A million is nothing compared to that.
hero member
Activity: 543
Merit: 500
Ok I got that part, both of them will get the payment,
BUT both of them are able to spend it too. REASON: I send the bitcoin to an address, has nothing to do with private key.
John Address is : AAAAA
Sarah Address is: AAAAA

so both open their wallets, they see 10 bitcoins I sent

Even if they have different private keys, since I sent it to an address and not a private key, then the transaction will show on both and both are able to spend it, just a matter of who spend it faster!


This part is correct.

Now John will spend 3 bitcoins.
Then it will show both of them have 7 Bitcoins left.
Then Sarah will spend 5 bitcoins.
Then it will show both of them have 2 bitcoin left.

Just a side note, when bitcoin are spent, you can't use a transaction output partially.
So, if John want to send CrapMan 3 BTC with a piece of "10 BTC" on his address, he need to create a transaction with that 10 btc as input, a output of "3 btc" to address 1 (controlled by CrapMan) and a output of "7 btc" to address 2 (controlled by John).

For most wallets software, by default, the wallet will generate a new change address every time to improve anonymity.
So, after John spend 3 btc, the common addresses held by John and Sarah will have nothing on it.

FYR: https://en.bitcoin.it/wiki/Change
newbie
Activity: 42
Merit: 0

What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?



That would be decided on by the miners. Once an address is in the network a new one will not be created the same.

Not really.
You never "announce" your address to the network, and there is no one doing the checking at all.
In fact, there are many ways you can generate your address offline easily.


Ops! now all someone has to do is: download the wallet Client, and make millions of wallets and he might get lucky, specially with all the the huge exchanges and transactions around the world right now and people moving Bitcoins in and out creating different wallets ...etc
newbie
Activity: 42
Merit: 0
I am little confused here.
Even if it is a very ridiculously low percent for this to happen, but let's say it happened,
1- John and Sarah got the same address.
2- I hired Sarah and want to pay her with bitcoin, she sent me her address
3- I sent the money to the address
What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?

As I said, the bitcoin is not in your wallet, it is on the blockchain (the public ledger).

When John runs his wallet software and after syncing, he will get a message of "receiving a bitcoin payment".
When Sarah runs her wallet software and after syncing, she will get a message of "receiving a bitcoin payment".

When Sarah used that piece of bitcoin for a transaction, John will suddenly find that "his bitcoin" has been used in a transaction he didn't initiated. He will be panic and believe his computer has been hacked. Smiley



Ok I got that part, both of them will get the payment,
BUT both of them are able to spend it too. REASON: I send the bitcoin to an address, has nothing to do with private key.
John Address is : AAAAA
Sarah Address is: AAAAA

so both open their wallets, they see 10 bitcoins I sent

Now John will spend 3 bitcoins.
Then it will show both of them have 7 Bitcoins left.
Then Sarah will spend 5 bitcoins.
Then it will show both of them have 2 bitcoin left.

Even if they have different private keys, since I sent it to an address and not a private key, then the transaction will show on both and both are able to spend it, just a matter of who spend it faster!
hero member
Activity: 543
Merit: 500

What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?



That would be decided on by the miners. Once an address is in the network a new one will not be created the same.

Not really.
You never "announce" your address to the network, and there is no one doing the checking at all.
In fact, there are many ways you can generate your address offline easily.
hero member
Activity: 525
Merit: 500

What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?



That would be decided on by the miners. Once an address is in the network a new one will not be created the same.
hero member
Activity: 543
Merit: 500
An overly simplified analogy would be:

I have a mailbox out of my house. I give you my address so that you can send me a postcard.
When you send me the postcard, it will arrive at my mailbox.

As I have the key, I can open the mailbox to take the postcard.
My mother, my father and my sister also have a key, so they can also open the mailbox to take the postcard.

So, my sister can take the postcard and throw it away because she hates you, and I cannot use it (in this case read it) myself.

But as everything in bitcoin is public and so even if John received your payment and spent the bitcoin soon after, Sarah will still notice a strange payment in and out.
global moderator
Activity: 3990
Merit: 2717
Join the world-leading crypto sportsbook NOW!
I think you're trying to read too much into the workings of Bitcoin and confusing yourself.  It's good to have an understanding of the protocol and how it works, but the process is quite simple once you actually just start using it, and whilst it was created by a genius, you certainly don't need to be one to use it  Cheesy.

You are absolutely right, I am just trying to do some homework.
It is really fascinating how this can work, and it is even more amazing how people loved it from all over the work and put so much money in it and take a huge risk for something that represent only numbers on a screen.
If this really works the way it is supposed to be then the potentials are huge and I would rather be few years from now some who understand how it works than being someone who is just left behind by the rest of the world. that's all.

I really appreciate your help so much, Peter's help too, and everyone else, I am learning a lot.

Fiat money is only really 'numbers on a screen'. I think you'd be wise at getting in and trying to understand it now because you might kick yourself in the future. Bitcoin really does have the potential to be a revolutionary concept.
hero member
Activity: 543
Merit: 500
I am little confused here.
Even if it is a very ridiculously low percent for this to happen, but let's say it happened,
1- John and Sarah got the same address.
2- I hired Sarah and want to pay her with bitcoin, she sent me her address
3- I sent the money to the address
What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?

As I said, the bitcoin is not in your wallet, it is on the blockchain (the public ledger).

When John runs his wallet software and after syncing, he will get a message of "receiving a bitcoin payment".
When Sarah runs her wallet software and after syncing, she will get a message of "receiving a bitcoin payment".

When Sarah used that piece of bitcoin for a transaction, John will suddenly find that "his bitcoin" has been used in a transaction he didn't initiated. He will be panic and believe his computer has been hacked. Smiley

newbie
Activity: 42
Merit: 0
I think you're trying to read too much into the workings of Bitcoin and confusing yourself.  It's good to have an understanding of the protocol and how it works, but the process is quite simple once you actually just start using it, and whilst it was created by a genius, you certainly don't need to be one to use it  Cheesy.

You are absolutely right, I am just trying to do some homework.
It is really fascinating how this can work, and it is even more amazing how people loved it from all over the work and put so much money in it and take a huge risk for something that represent only numbers on a screen.
If this really works the way it is supposed to be then the potentials are huge and I would rather be few years from now some who understand how it works than being someone who is just left behind by the rest of the world. that's all.

I really appreciate your help so much, Peter's help too, and everyone else, I am learning a lot.
newbie
Activity: 42
Merit: 0
However that leave a question in my mind: if it just happened that 2 people got the same address. someone sent money to that address, who will get it? will it be figured out by miners and corrected? or what?

Example: Bill Gates and me got the same wallet address, some company paid Bill Gates Bitcoins worth 10 billions, who will get the coins, me or Bill Gates?


If someone obtains your private keys, he/she can spend it right away.
As I mentioned in an earlier reply, whoever gets the private key, he/she can spend it.

Indeed the bitcoin is not in your wallet even if you see a positive balance on your wallet software.
That's why you just need to backup your wallet file (a collection of private keys) and all your funds sent to the address after the backup can still be restored later.

Say, if there is some bitcoin on an address, anyone having the private key associated with that address can create and sign a transaction to spend the bitcoin.
Of course, the chance of 2 people having the same address is ridiculously low, so it is not really a problem (unless you are using a bad random number generator).


I am little confused here.
Even if it is a very ridiculously low percent for this to happen, but let's say it happened,
1- John and Sarah got the same address.
2- I hired Sarah and want to pay her with bitcoin, she sent me her address
3- I sent the money to the address
What is going to happen is: the bitcoins will get confused, cause they are going to 2 different place with the same address, which way the bitcoin will chose? John? or Sarah?
I don't think it has anything to do with the private key, whoever will get the bitcoin to the wallet will be able to spend it.
I mean the bitcoin I sent went to Sarah's wallet the she gets to spend it, but if the bitcoin chose to go to John then John will get to spend it.
Which way the bitcoin will go?

Pages:
Jump to: