Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bit9999 on October 17, 2017, 03:56:31 PM



Title: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 17, 2017, 03:56:31 PM
Hey guys,

Anyone knows how those bitcoin exchanges can randomly generate btc address for a new signed up account? Also, a new random address can be automatically generated each time we click on deposit tab. How do they achieve that automatically? Those addresses are all generated from one online wallet?

When user deposits real bitcoin, how does the exchange recognize those addresses are linked to a certain account, so that it can credit that account automatically?

Thansk ;D


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: DannyHamilton on October 17, 2017, 04:21:52 PM
Hey guys,

Anyone knows how those bitcoin exchanges can randomly generate btc address for a new signed up account? Also, a new random address can be automatically generated each time we click on deposit tab. How do they achieve that automatically?

Maths.

It's pretty easy.

  • Choose a very random number from a very big set of numbers. This is the private key.
  • Calculate the ECDSA public key.
  • Hash the public key.
  • Convert the result to base58check encoding.

That's it.  That's how you generate a new bitcoin address.  Most modern computers can do it in less than a thousandth of a second.

Those addresses are all generated from one online wallet?

That is an implementation detail that is up to the service provider to decide for themselves.  They could store them all in one wallet, they could use multiple wallets, or they might just store each private key individually.

When user deposits real bitcoin, how does the exchange recognize those addresses are linked to a certain account, so that it can credit that account automatically?

They only gave the address to one person.  Therefore, when they receive a payment at the address, they assume it is for the person who they gave the address to.

Think of a bitcoin address like an invoice number.  Someone wants to send you some bitcoins for some reason.  You generate an invoice number (bitcoin address) for that person for that purpose.  Now when bitcoins are received with the invoice number (the address), you know what they are for.


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 18, 2017, 03:31:34 PM
Quote
Choose a very random number from a very big set of numbers. This is the private key.

Hi Danny, many thanks. I thought private keys are generated by online wallets? Sorry not quite get how to generate private keys automatically here. Could you explain a bit more? Thanks!


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: DannyHamilton on October 18, 2017, 03:54:13 PM
Quote
Choose a very random number from a very big set of numbers. This is the private key.

Hi Danny, many thanks. I thought private keys are generated by online wallets? Sorry not quite get how to generate private keys automatically here. Could you explain a bit more? Thanks!

A private key is just a very random number from a very big set of numbers.

Specifically, every number from 1 to 115792089237316195423570985008687907852837564279074904382605163141518161494336 is a valid private key.

When an online wallet, or offline wallet "generates a private key", all they are doing is picking a random number in that range.

What is important when "generating a private key" is that the number that is chosen is random enough.  In maths, the word that is used to describe the amount of "randomness" is entropy.  So, you will often hear people state that you need to make sure you use enough entropy when choosing the private key.



Title: Re: multi random btc address generation with bitcoin exchanges
Post by: acquafredda on October 18, 2017, 05:40:53 PM
Apart from Danny Hamilton's explanation if you like to play with this entropy and have a look at how these public/private keys get generated try
https://www.bitaddress.org
Every key pair you generate is unique and you could use it but if you don't know how to manage those keys without a wallet, don't use them.
Do your own research first
;)


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: pebwindkraft on October 18, 2017, 06:56:20 PM
Just wondering, if s.th. like a HD Wallet is used? I haven't checked their code, but maybe someone knows?
I wouldn't want my webserver handle priv keys...
With a HD wallet, the webserver would only need to deal with xpubkeys, and doesn't need access to the original private key.
I think a Hierarchical Deterministic Wallet (BIP0032/BIP0044) can produce 2^31 addresses...



Title: Re: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 20, 2017, 09:54:56 AM
Quote
Choose a very random number from a very big set of numbers. This is the private key.

Hi Danny, many thanks. I thought private keys are generated by online wallets? Sorry not quite get how to generate private keys automatically here. Could you explain a bit more? Thanks!

A private key is just a very random number from a very big set of numbers.

Specifically, every number from 1 to 115792089237316195423570985008687907852837564279074904382605163141518161494336 is a valid private key.

When an online wallet, or offline wallet "generates a private key", all they are doing is picking a random number in that range.

What is important when "generating a private key" is that the number that is chosen is random enough.  In maths, the word that is used to describe the amount of "randomness" is entropy.  So, you will often hear people state that you need to make sure you use enough entropy when choosing the private key.



How do we ensure the safety of the private keys if they are all generated online? How do we protect the private key info or if we are going to install them in a server db, how do ensure it will not be copied or altered?


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: acquafredda on October 21, 2017, 12:16:12 PM
You are getting a bit confused now: please refer to the following links to have an idea of how those addresses get generated
https://en.bitcoin.it/wiki/Address
https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses

Consider this only: whatever the procedure used by exchanges to give you an address remember you don't own the keys there! Whatever their security policy you will have to trust them.

If you generated addresses from a proper bitcoin wallet you are the keys owner and you are fine!


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: neurotypical on October 21, 2017, 05:33:50 PM
Hey guys,

Anyone knows how those bitcoin exchanges can randomly generate btc address for a new signed up account? Also, a new random address can be automatically generated each time we click on deposit tab.


What exchange are you using that generates new deposit addresses every time you click on the deposit tab?

Every exchange that i've used so far, generates only 1 deposit address per account. My deposit address in Poloniex has been the same forever, which is total shit when it comes to privacy btw.

Exchanges should generate a deposit address, and once used, the next time you click deposit it should be new, but thus far, it seems every exchange I use keeps the same address.


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: acquafredda on October 22, 2017, 10:36:14 AM
They do it for AML (anti-money laundering) mostly so that there's an effective way (for them) to link all your money sources if they need. I am curious to know which exchange provides the ability to create new addresses at will


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: Spendulus on October 22, 2017, 01:13:34 PM
....
How do we ensure the safety of the private keys if they are all generated online? How do we protect the private key info or if we are going to install them in a server db, how do ensure it will not be copied or altered?

Safety of online keys does not exist if the bytes of the private key are transmitted between computers or through networks.



Title: Re: multi random btc address generation with bitcoin exchanges
Post by: pebwindkraft on October 23, 2017, 09:40:25 AM
...
Every exchange that i've used so far, generates only 1 deposit address per account. My deposit address in Poloniex has been the same forever, which is total shit when it comes to privacy btw.

HitBTC gives me everytime a new address, BitTRex as well, and on bitcoin.de also. So you should rething your usage of exchanges?  ;D


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: Coin12 on October 24, 2017, 12:30:11 AM
I am not really good on this. I only know that in my exchange i have only address and i use it more than one time.
But you said it generate evry time you want to deposit. Maybe each exchange has different rule.
How exchange know when the person send bitcoin and the amount sending deposit to the persons account.  It can be done by exchange very easy since they give 1 address to one person so everyone has different address.


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: Taras on October 24, 2017, 02:39:53 AM
How exchange know when the person send bitcoin and the amount sending deposit to the persons account.
Their wallet lets the exchange software know when money comes in, with information like how much there is, what address got it, etc. From there, the exchange software can figure out who the beneficiary is and add the funds to their account.


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 24, 2017, 02:16:26 PM
Hey guys,

Anyone knows how those bitcoin exchanges can randomly generate btc address for a new signed up account? Also, a new random address can be automatically generated each time we click on deposit tab.


What exchange are you using that generates new deposit addresses every time you click on the deposit tab?

Every exchange that i've used so far, generates only 1 deposit address per account. My deposit address in Poloniex has been the same forever, which is total shit when it comes to privacy btw.

Exchanges should generate a deposit address, and once used, the next time you click deposit it should be new, but thus far, it seems every exchange I use keeps the same address.

Far as i know bitstamp allows you to create new deposit address each time.


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 24, 2017, 02:27:25 PM
How exchange know when the person send bitcoin and the amount sending deposit to the persons account.
Their wallet lets the exchange software know when money comes in, with information like how much there is, what address got it, etc. From there, the exchange software can figure out who the beneficiary is and add the funds to their account.

Do they use any special wallet or the same wallet in the market?


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: bit9999 on October 24, 2017, 02:43:33 PM
....
How do we ensure the safety of the private keys if they are all generated online? How do we protect the private key info or if we are going to install them in a server db, how do ensure it will not be copied or altered?

Safety of online keys does not exist if the bytes of the private key are transmitted between computers or through networks.



How does exchange ensure the safety of the coins then? Do they encrypt the private keys (and does it work?)?


Title: Re: multi random btc address generation with bitcoin exchanges
Post by: Taras on October 25, 2017, 03:46:51 AM
How exchange know when the person send bitcoin and the amount sending deposit to the persons account.
Their wallet lets the exchange software know when money comes in, with information like how much there is, what address got it, etc. From there, the exchange software can figure out who the beneficiary is and add the funds to their account.

Do they use any special wallet or the same wallet in the market?

Just Bitcoin Core, a wallet which plenty of normal people use, is fine, as long as you have RPC enabled to allow the exchange script to communicate with it.