Author

Topic: How Does Key Sweeping Work? (Read 789 times)

legendary
Activity: 1988
Merit: 1007
May 18, 2014, 11:41:46 PM
#13
Yes, each private key contains within it the ability to know the address associated with it.  So for example if you gave me one of your private keys then I could immediately steal the coins on that address, even if you didn't give me the address.  Because it's easy to find the address from a private key.  However if you gave me the address I can't do anything with it but look at how many coins it has because it's impossible to get the private key from the address.
Thanks for clarifying all of this for me. The way the system works is completely different than how I envisioned it.

You definitely made it more clear though!

You'll find that much of bitcoin works completely differently than how most people envision it. We use many words and phrases to represent the protection and transfer of control of value that form a particular image in the minds of the typical listener.  These images make it easier to talk at a high level about "spending" or "receiving" bitcoins.  As you learn more about bitcoin, you'll discover that the technical details involved are very different than the common descriptions.

True. I've ran into many things I misinterpreted based on how they were stated. I tried delving into the code as well but that left me completely baffled (I'm a newbie when it comes to C++). Slowly but surely I'm learning though! Mostly just cutting it into more consumable chunks for digesting (so to speak).
legendary
Activity: 3472
Merit: 4801
May 18, 2014, 11:37:02 PM
#12
Yes, each private key contains within it the ability to know the address associated with it.  So for example if you gave me one of your private keys then I could immediately steal the coins on that address, even if you didn't give me the address.  Because it's easy to find the address from a private key.  However if you gave me the address I can't do anything with it but look at how many coins it has because it's impossible to get the private key from the address.
Thanks for clarifying all of this for me. The way the system works is completely different than how I envisioned it.

You definitely made it more clear though!

You'll find that much of bitcoin works completely differently than how most people envision it. We use many words and phrases to represent the protection and transfer of control of value that form a particular image in the minds of the typical listener.  These images make it easier to talk at a high level about "spending" or "receiving" bitcoins.  As you learn more about bitcoin, you'll discover that the technical details involved are very different than the common descriptions.
legendary
Activity: 1988
Merit: 1007
May 18, 2014, 08:10:28 PM
#11
Yes, each private key contains within it the ability to know the address associated with it.  So for example if you gave me one of your private keys then I could immediately steal the coins on that address, even if you didn't give me the address.  Because it's easy to find the address from a private key.  However if you gave me the address I can't do anything with it but look at how many coins it has because it's impossible to get the private key from the address.



Thanks for clarifying all of this for me. The way the system works is completely different than how I envisioned it.

You definitely made it more clear though!
cp1
hero member
Activity: 616
Merit: 500
Stop using branwallets
May 18, 2014, 08:08:21 PM
#10
Yes, each private key contains within it the ability to know the address associated with it.  So for example if you gave me one of your private keys then I could immediately steal the coins on that address, even if you didn't give me the address.  Because it's easy to find the address from a private key.  However if you gave me the address I can't do anything with it but look at how many coins it has because it's impossible to get the private key from the address.

legendary
Activity: 1988
Merit: 1007
May 18, 2014, 08:05:51 PM
#9

I was under the impression, though, that I could have (I'm shortening addresses for brevity):

One wallet with its private key. 5 Addresses with the following balances:

1jAdjflsjkfsdf32423lk - 0.01 BTC
1jAdjflsjkfsdf23j44lkl - 0.03 BTC
1jAdjflsjkfsdf234234 - 0.03 BTC
1jAdjflsjkfsdf23j423l - 0.03 BTC
1jAdjflsjkfsdf2342l3l - 0.05 BTC

Now, my understanding is that you could use a "sweeper" (or import, maybe?) to take just the private key and automatically know that there are 0.15 BTC associated with it (by taking all of the possible addresses and pulling in their balances). Is this where my understanding was wrong?

Those 5 addresses each have their own private keys associated with them.  If you want to sweep those funds you'll need to use each of the 5 keys.  Just think of sweep as take or steal.

Ah, I think I'm catching on now. So to clarify:

I just did a key export from a client (out of curiosity) and it gave multiple private keys. Sweeping these takes in each private key and determines what address it goes to, and then can access those funds, correct?

So really we don't even need to know any addresses, as long as you have the private key that came from each one?
cp1
hero member
Activity: 616
Merit: 500
Stop using branwallets
May 18, 2014, 08:01:33 PM
#8

I was under the impression, though, that I could have (I'm shortening addresses for brevity):

One wallet with its private key. 5 Addresses with the following balances:

1jAdjflsjkfsdf32423lk - 0.01 BTC
1jAdjflsjkfsdf23j44lkl - 0.03 BTC
1jAdjflsjkfsdf234234 - 0.03 BTC
1jAdjflsjkfsdf23j423l - 0.03 BTC
1jAdjflsjkfsdf2342l3l - 0.05 BTC

Now, my understanding is that you could use a "sweeper" (or import, maybe?) to take just the private key and automatically know that there are 0.15 BTC associated with it (by taking all of the possible addresses and pulling in their balances). Is this where my understanding was wrong?

Those 5 addresses each have their own private keys associated with them.  If you want to sweep those funds you'll need to use each of the 5 keys.  Just think of sweep as spend, take, or steal.
legendary
Activity: 1988
Merit: 1007
May 18, 2014, 07:56:46 PM
#7
I added a corrected question. It was addresses I was thinking of, not public keys. That's my fault (I'm still new to HOW Bitcoin and others work, which is also why I'm asking the question, :p).

So address-wise... how are you able to sweep all possible addresses when they are generated randomly to begin with?

As Foxpup said, the private key really only corresponds to one address.  All sweeping means is that you spend whatever is in that address and send it to a new one.

Imagine having an online wallet with address A
And a cold offline wallet with address B, where I've written the private key on a piece of paper.

If I open my online wallet and sweep that offline private key that corresponds to address B then it'll send whatever is in B to address A.  My online wallet still only has address A, but it has all the coins from B in that address A as well.

That's different than importing a private key.  If I imported the private B key into my online wallet then it would have both addresses A and B.


I was under the impression, though, that I could have (I'm shortening addresses for brevity):

One wallet with its private key. 5 Addresses with the following balances:

1jAdjflsjkfsdf32423lk - 0.01 BTC
1jAdjflsjkfsdf23j44lkl - 0.03 BTC
1jAdjflsjkfsdf234234 - 0.03 BTC
1jAdjflsjkfsdf23j423l - 0.03 BTC
1jAdjflsjkfsdf2342l3l - 0.05 BTC

Now, my understanding is that you could use a "sweeper" (or import, maybe?) to take just the private key and automatically know that there are 0.15 BTC associated with it (by taking all of the possible addresses and pulling in their balances). Is this where my understanding was wrong?
cp1
hero member
Activity: 616
Merit: 500
Stop using branwallets
May 18, 2014, 07:52:57 PM
#6
I added a corrected question. It was addresses I was thinking of, not public keys. That's my fault (I'm still new to HOW Bitcoin and others work, which is also why I'm asking the question, :p).

So address-wise... how are you able to sweep all possible addresses when they are generated randomly to begin with?

As Foxpup said, the private key really only corresponds to one address.  All sweeping means is that you spend whatever is in that address and send it to a new one.

Imagine having an online wallet with address A
And a cold offline wallet with address B, where I've written the private key on a piece of paper.

If I open my online wallet and sweep that offline private key that corresponds to address B then it'll send whatever is in B to address A.  My online wallet still only has address A, but it has all the coins from B in that address A as well.

That's different than importing a private key.  If I imported the private B key into my online wallet then it would have both addresses A and B.

You can read how to get the bitcoin address from the corresponding private key here:  https://en.bitcoin.it/wiki/Technical_background_of_Bitcoin_addresses
The key to bitcoin is that you can go from step 0 to step 9 easily, but going backwards from 9 to 0 is impossible.
legendary
Activity: 1988
Merit: 1007
May 18, 2014, 07:41:30 PM
#5
There are many private keys for each bitcoin address, not the other way around.  But don't worry about that.

Perhaps you're thinking of a deterministic seed?  Those generate a private key / public key pair by incrementing a counter, so you just need to keep incrementing the counter until you stop finding addresses with activity on them.

I added a corrected question. It was addresses I was thinking of, not public keys. That's my fault (I'm still new to HOW Bitcoin and others work, which is also why I'm asking the question, :p).

So address-wise... how are you able to sweep all possible addresses when they are generated randomly to begin with?
cp1
hero member
Activity: 616
Merit: 500
Stop using branwallets
May 18, 2014, 07:39:55 PM
#4
There are many private keys for each bitcoin address, not the other way around.  But don't worry about that.

Perhaps you're thinking of a deterministic seed?  Those generate a private key / public key pair by incrementing a counter, so you just need to keep incrementing the counter until you stop finding addresses with activity on them.
legendary
Activity: 1988
Merit: 1007
May 18, 2014, 07:39:34 PM
#3
there can be billions of different public keys generated with any given private key
Where'd you get this crazy idea? There is only one public key for a given private key, and only two ways that public key can be represented (compressed and uncompressed), giving two addresses. Not billions. Note also that private keys in wallet import format specify which of the two addresses should be used.

I think I misrepresented the question.

I guess the proper question is how you can sweep all the addresses when there are billions of those.
legendary
Activity: 4542
Merit: 3393
Vile Vixen and Miss Bitcointalk 2021-2023
May 18, 2014, 07:27:55 PM
#2
there can be billions of different public keys generated with any given private key
Where'd you get this crazy idea? There is only one public key for a given private key, and only two ways that public key can be represented (compressed and uncompressed), giving two addresses. Not billions. Note also that private keys in wallet import format specify which of the two addresses should be used.
legendary
Activity: 1988
Merit: 1007
May 18, 2014, 06:26:05 PM
#1
Hopefully this is the right area to ask this. I'm wondering how key sweeping works. I know there are clients and sites that can do it, but I don't quite follow. It's based on the private key, of course, but when there can be billions of different public keys generated with any given private key, how is it that the client can sweep every possibility (and can usually do it within a second or two)?

Or am I completely misunderstanding how the blockchain is read and how the keys work?
Jump to: