Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: zaryabbkh on April 24, 2019, 07:25:46 AM



Title: Storing private keys on servers
Post by: zaryabbkh on April 24, 2019, 07:25:46 AM
Hi, I'm newbie in crypto world and working on a tranding platform. I've to generate separate addresses against every user and stuck at how to securely store the private keys. I've looked into the ecc encryption, AWS KMS, and hashicorp vault but the common thing among all the methods is, the decryption password or token is still stored on the server. So if the server got compromised everything is gone. Now my question is what is the best way to store the private keys. Thanks! 


Title: Re: Storing private keys on servers
Post by: Pmalek on April 24, 2019, 07:35:01 AM
The safest way would be not storing them on any server at all. Sorry for going a bit off topic but I wouldn't trust a random site with my private keys. You explained the reasons yourself. They can be hacked or obtained by a malicious third party.


Title: Re: Storing private keys on servers
Post by: bob123 on April 24, 2019, 07:35:16 AM
Don't store them on your online server.

If you can allow to delay payouts / withdrawals by a few hours:
- Create a 2-server-setup with one being your webserver and one being 'offline'.
- Make use of 2 wallets (hot- and cold wallet)
- Every X hours batch the transactions, verify them, do sanity checks, and create a payment request to your 'offline server'.
- Your 'offline-server' should then handle all payments (make sure to secure it with a firewall and only allow specific incoming requests from your webserver + outgoing requests to broadcast the transactions) from the hot wallet.
- Top up the hot wallet with the cold wallet funds when necessary (manually) or withdraw from the hot wallet to the cold wallet (automatically).


If you want 'instant' withdrawals:
- Make use of 2 wallets (hot- and cold wallet)
- Only keep a limited amount on your hot wallet (on the web server). It has to be an amount which you can afford to lose in case of an attack.
- Top it up with your cold wallet funds when necessary.


But generally:
If you are going to build a trading platform yourself (without developer who build the whole software with security in mind (from the very beginning)), you are guaranteed to have vulnerabilities.
And these vulnerabilities will be exploited if it is worth it for the attacker.

If you really want to build a professional platform and need to handle funds of users, hire some competent security-minded developer.
It is not going to be cheap, but it will save you a lot of money in the long run (given that you really want to build a professional platform).


Title: Re: Storing private keys on servers
Post by: NeuroticFish on April 24, 2019, 07:40:22 AM
Since you are custodian for the funds, you don't need private key for each user. Each user will have its own receiving address. The sending happens from the wallets that suits you best.
Sending the funds has to be batched for the sake of network, for making the tx fees smaller and for double checking them. And you'll clearly need cold storage too.


Title: Re: Storing private keys on servers
Post by: mocacinno on April 24, 2019, 07:44:53 AM
I agree for 100% with bob123, NeuroticFish and Pmalek, do not store private keys, seeds, xprv's,... on an online machine.

However, i did wanted to add one remark: there seems to be a misconception about hashicorp's vault in your OP: if you're storing the unseal keys or root tokens on your online machine, you're doing it wrong... But i do have to agree that IF you unsealed your vault AND your system gets compromised AND the hacker gets his hands on your machine AND a token (or user/pass or...) he will be able to get your private keys from your server if you were storing them in vault... It's the chicken or the egg dilemma, if you want your scripts to be able to access your private keys directly, a hacker will always have a loophole to do thesame. So your best sollution would be not to store your private keys on an online machine ;)

There are tons of exchanges that had excellent programmers and security audits and strict procedures but still got abused in the end... Don't make the mistake of thinking you're better than those exchanges!


Title: Re: Storing private keys on servers
Post by: zaryabbkh on April 24, 2019, 08:05:59 AM
Really Thanks for such a quick and valuable responses Pmalek, bob123, NeuroticFish and mocacinno. I'll look into this. The gist is either prepare for the hack using hot wallets or compromise the user experience over security using cold wallets.



I'm learning to be a security-minded developer and definitely be the one with the help of you peoples.  :)


Title: Re: Storing private keys on servers
Post by: LFC_Bitcoin on April 24, 2019, 01:56:46 PM
OP,

FFS man, do not store your private keys on an online server. Keep them on a hardware wallet, USB stick or paper wallet. Don’t risk storing them anywhere that somebody could gain access to.

Your idea sounds like a nightmare waiting to happen. You’re clearly tech minded so you’re not a stupid guy. Common sense is priceless though, treat your private keys like you would the most valuable thing you own - i.e. away from everybody else.


Title: Re: Storing private keys on servers
Post by: buwaytress on April 24, 2019, 02:26:56 PM
Did I misunderstand something or am I seeing something OP is saying: that for every user, he is creating a new wallet and new set of private keys? To my understanding most online services are actually only using 1 wallet (or a set of wallets) and therefore just the 1 set of private keys (or a few for a few sets of wallets). Every client gets a unique address, but they actually all belong to the same wallet, hence individual deposits get batched up and can be combined to process other client withdrawals.

So if OP is indeed creating a unique WALLET for each customer, then why not make it so you only issue them addresses from fewer wallets?

OR make their private key their responsibility (as should anyway be the case?)? It's sort of a win-win. They keep their own keys, you also de-risk.

Apologies in advance if I've veered off the reserve!


Title: Re: Storing private keys on servers
Post by: khaled0111 on April 24, 2019, 04:23:26 PM
If you want 'instant' withdrawals:
- Make use of 2 wallets (hot- and cold wallet)
- Only keep a limited amount on your hot wallet (on the web server). It has to be an amount which you can afford to lose in case of an attack.
- Top it up with your cold wallet funds when necessary.

If his customers are fine with delayed withdrawals, then what you proposed is the most suitable solution.

But if they need instant withdrawals and full control over their funds (not possible with hot/cold solution), then you may consider this solution:
     -generate a private key for each user
     -save the private keys (plain text) on an offline database
     -encrypt private keys with a random key for each user
     -save the encrypted private keys on the server's database
     -give the user the key needed to decrypt his private key

This way, your customer will be able to use his private key without knowing it and it will be safe in cas the server gets compromised.



Title: Re: Storing private keys on servers
Post by: aliashraf on April 24, 2019, 04:57:14 PM
op,
You need to check HD wallets (https://bitcoin.org/en/glossary/hd-protocol) concept. As @buwaytress has correctly reminded you don't need a separate key pair/wallet for each user/invoice, a single HD wallet could generate as many receiving addresses as you wish, feel free to store them in your database for further accounting references and keep the private key secure/off-line/cold. Good luck.


Title: Re: Storing private keys on servers
Post by: franky1 on April 24, 2019, 06:40:27 PM
there is no such thing as "instant pay" in bitcoin. a confirm is ~10mins.
this means without having a private key anywhere on the web server you can still offer a PROMPT service within the acceptable tolerance of 10mins

the easiest method is when a user makes a withdrawal request. this request does not trigger signing a transaction on the webserver, but puts a withdrawal request into a database. and the web server never needs to list a IP address or make and calls out.. instead a remote system can securely look in on the withdrawal request database every 20seconds-2minutes. see what needs to be processed and then process it remotely knowing it will be in a block within the tolerable timescale


thus the webserver has no keys now any listing of the remote system because the webserver does not transmit anything. it just lists items


Title: Re: Storing private keys on servers
Post by: PrimeNumber7 on April 25, 2019, 05:25:14 AM
For those who are suggesting to not store private keys on an online machine, for most bitcoin and crypto businesses, this is not an option. The marketplace demands quick withdrawals in most instances with exceptions for large withdrawals.

An online business will, by design, need to store SSL keys online, and this in some ways is similar to storing even cold storage keys online, to an extent, because a hacker can potentially impersonate your website and display deposit addresses for customers that belong to the hacker. In order for this attack to be successful, more than just the SSL keys will need to be compromised.

I generally agree with bob123's comments with regards to only storing limited amounts of coins on your server, and to top off your "hot" wallet when necessary. I would also warn that if your database server is compromised, a hacker may trick you into believing a certain user has a larger balance available for withdrawal than is actually true. This means you will need to independently verify the integrity of your database each time you remove coins from your "cold" wallet; this is true even if you do not keep any coins on an online server.

A good rule of thumb is to not keep more than 1-2 months expected earnings worth of crypto in your online storage so in case your server does get hacked, you can easily "earn" your way out of the losses.

I do not wish to give you specific advice or suggestions on how to protect your customer's money, in large part because I cannot ensure you will hear any of my ongoing advice, and will not be in a position to ensure you are correctly implementing what I am suggesting.

If you do not personally know how to protect your private keys and the integrity of your DB, I would suggest you hire someone who has experience doing this job function who you can independently verify to be an "expert"


Title: Re: Storing private keys on servers
Post by: odolvlobo on April 25, 2019, 06:29:16 AM
Companies that are serious about security use this: Hardware Security Module (https://en.wikipedia.org/wiki/Hardware_security_module)


Title: Re: Storing private keys on servers
Post by: bob123 on April 25, 2019, 06:31:36 AM
OP,

FFS man, do not store your private keys on an online server. Keep them on a hardware wallet, USB stick or paper wallet. Don’t risk storing them anywhere that somebody could gain access to.

Your idea sounds like a nightmare waiting to happen. You’re clearly tech minded so you’re not a stupid guy. Common sense is priceless though, treat your private keys like you would the most valuable thing you own - i.e. away from everybody else.

Did you even read the OP ? I guess not..




Did I misunderstand something or am I seeing something OP is saying: that for every user, he is creating a new wallet and new set of private keys?

He wants to create one address (implies 1 private key) for each user, as mentioned in his OP.
Not a separate wallet for each user.




But if they need instant withdrawals and full control over their funds (not possible with hot/cold solution), then you may consider this solution:
     -generate a private key for each user
     -save the private keys (plain text) on an offline database
     -encrypt private keys with a random key for each user
     -save the encrypted private keys on the server's database
     -give the user the key needed to decrypt his private key

This way, your customer will be able to use his private key without knowing it and it will be safe in cas the server gets compromised.

Why does the user need the key to decrypt the private key if he doesn't have access to the private key anyway ?
Also, you most likely don't want each user to be able to have access to the private keys. This creates room for exploitation.

The funds of the user are managed in a database and the coins should get consolidated anyway (when the fees are low).




[...]
If you do not personally know how to protect your private keys and the integrity of your DB, I would suggest you hire someone who has experience doing this job function who you can independently verify to be an "expert"

^This.

No system is completely secure.
You need to hire experts which can be made liable in case of an obvious data breach. Not some random online guy.

Vulnerabilities will exist, it is important to have a plan to reduce possible damage and to make sure that the total amount of damage is limited.
For example, it has to be completely bulletproof that an attacker can't add withdrawal requests AND top up the hot wallet from your cold wallet. This would be a disaster.




Companies that are serious about security use this: Hardware Security Module (https://en.wikipedia.org/wiki/Hardware_security_module)

That's currently not the topic.
Such a module won't help you if an attacker can manipulate the database which handles the withdrawals.

It is necessary to have a good concept, then focus on the hardware you are using.


Title: Re: Storing private keys on servers
Post by: zaryabbkh on April 25, 2019, 01:34:39 PM
Thanks bob123 for such a great clarification.

yeah the issue is I've to generate separate address for each user and in case of ethereum the hd wallets doesn't works like bitcoin where we can just select UTXOs and make a transaction.

bob123 gives the most optimal solution
If you want 'instant' withdrawals:
- Make use of 2 wallets (hot- and cold wallet)
- Only keep a limited amount on your hot wallet (on the web server). It has to be an amount which you can afford to lose in case of an attack.
- Top it up with your cold wallet funds when necessary.

and if we add this from PrimeNumber7
A good rule of thumb is to not keep more than 1-2 months expected earnings worth of crypto in your online storage so in case your server does get hacked, you can easily "earn" your way out of the losses.

also thanks for pointing out this issue

I would also warn that if your database server is compromised, a hacker may trick you into believing a certain user has a larger balance available for withdrawal than is actually true. This means you will need to independently verify the integrity of your database each time you remove coins from your "cold" wallet; this is true even if you do not keep any coins on an online server.

i'll keep track of all these valuable suggestions and will share the final solution what I've got.

I do not wish to give you specific advice or suggestions on how to protect your customer's money, in large part because I cannot ensure you will hear any of my ongoing advice, and will not be in a position to ensure you are correctly implementing what I am suggesting.

Thanks!


Title: Re: Storing private keys on servers
Post by: aliashraf on April 25, 2019, 02:59:09 PM
yeah the issue is I've to generate separate address for each user and in case of ethereum the hd wallets doesn't works like bitcoin where we can just select UTXOs and make a transaction.
Wrong! HD wallets work just fine for both Ethereum and bitcoin and every other cryptographic system that is based on ECDSA standard. period.

Quote
bob123 gives the most optimal solution
No, he does not  :D
instead of wasting your time by catching up with irrelevant topics like cold vs hot wallets and alike, just focus on the main problem, you need multiple receiving addresses mapped to each user and a single master key to spend from all or not? Decide and choose the right direction....

P.S. say hello to Sh ... ;)


Title: Re: Storing private keys on servers
Post by: bob123 on April 26, 2019, 06:28:30 AM
Wrong! HD wallets work just fine for both Ethereum and bitcoin and every other cryptographic system that is based on ECDSA standard. period.

No.

OP is right, you are wrong.

Bitcoin is following a UTXO model, where ethereum has an account model.
This definitely makes a difference.

OP never said that HD wallets do not exist, he said that it works differently when comparing ethereum to bitcoin, which is correct.



Quote
bob123 gives the most optimal solution
No, he does not  :D
instead of wasting your time by catching up with irrelevant topics like cold vs hot wallets and alike, just focus on the main problem, you need multiple receiving addresses mapped to each user and a single master key to spend from all or not? Decide and choose the right direction....

Hot- / cold wallets is an irrelevant topic when hosting an online service which handles user funds?  ::) ::)

The 'main problem' is the mapping from addresses to user ??  ::)


I really don't get what you are trying to say.

If you believe the correct handling of the funds (hot-/cold wallet) is irrelevant, you obviously don't have a clue at all.
And if you additionally think that the mapping is a problem, you absolutely don't know what you are talking about. That is probably the easiest task of creating such a service..


Also, there is no reason to have a 'single master key' to spend funds from.
That's not even possible. You need 1 private for each address. The private keys can be derived using the same seed, but thats not the topic here at all (and won't allow you to spend funds from one 'master key')..

So.. instead of posting bullshit without having any clue, what about you browse through the forum for a few month first (to learn all the stuff you obviously don't know yet) before trying to 'help' someone ?



op,
You need to check HD wallets (https://bitcoin.org/en/glossary/hd-protocol) concept. As @buwaytress has correctly reminded you don't need a separate key pair/wallet for each user/invoice

Do you even know how a HD wallet works ?
Not like HD wallets would generate private keys or something silly like that...

Please stop creating post which contain anything 'technical' regarding bitcoin. You are just embarrassing yourself.


Title: Re: Storing private keys on servers
Post by: aliashraf on April 27, 2019, 09:29:22 PM
Wrong! HD wallets work just fine for both Ethereum and bitcoin and every other cryptographic system that is based on ECDSA standard. period.

No.

OP is right, you are wrong.

Bitcoin is following a UTXO model, where ethereum has an account model.
This definitely makes a difference.

OP never said that HD wallets do not exist, he said that it works differently when comparing ethereum to bitcoin, which is correct.

No.

you are trying to justify the wrong credit op gave to you, op claimed that HD wallets are not good because s/he was confused about what the concept is and you are escalating her confusion by talking about utxo vs account model, HD wallet concept is neutral about this issue and we have a lot of both commercial and opensource wallets that support multiple coins including bitcoin and Ethereum you are escalating op's confusion by spreading misinformation. Why? Just because she applauded you ignorantly?

Quote

Quote
bob123 gives the most optimal solution
No, he does not  :D
instead of wasting your time by catching up with irrelevant topics like cold vs hot wallets and alike, just focus on the main problem, you need multiple receiving addresses mapped to each user and a single master key to spend from all or not? Decide and choose the right direction....

Hot- / cold wallets is an irrelevant topic when hosting an online service which handles user funds?  ::) ::)

The 'main problem' is the mapping from addresses to user ??  ::)

If instead of trying to show-off you bother to read op's inquiry it is more than obvious that s/he is trying to handle thousands of private keys because s/he is not aware of HD wallets and the feasibility of having one master key and thousands of bitcoin addresses assigned to users, it is why s/he asks about the security of keeping track of so many private keys supposedly on a server using a database.

Quote


I really don't get what you are trying to say.

If you believe the correct handling of the funds (hot-/cold wallet) is irrelevant, you obviously don't have a clue at all.
And if you additionally think that the mapping is a problem, you absolutely don't know what you are talking about. That is probably the easiest task of creating such a service..


Also, there is no reason to have a 'single master key' to spend funds from.
That's not even possible. You need 1 private for each address. The private keys can be derived using the same seed, but thats not the topic here at all (and won't allow you to spend funds from one 'master key')..

So.. instead of posting bullshit without having any clue, what about you browse through the forum for a few month first (to learn all the stuff you obviously don't know yet) before trying to 'help' someone ?



op,
You need to check HD wallets (https://bitcoin.org/en/glossary/hd-protocol) concept. As @buwaytress has correctly reminded you don't need a separate key pair/wallet for each user/invoice

Do you even know how a HD wallet works ?
Not like HD wallets would generate private keys or something silly like that...

Please stop creating post which contain anything 'technical' regarding bitcoin. You are just embarrassing yourself.
Now you are teaching me HD wallets? ;D

It is really crazy, you give irrelevant information about hot wallet/cold wallet stuff to a confused newbie and s/he says thank you, then somebody tries to really help and you are attacking him because you desperately need the credit?  :D

Of course there is always a private key corresponding to a public key, the point with HD wallets is that you don't need to store the private keys like what op thinks instead your wallet software derives the corresponding private key from the master private key. You don't need to store this master private key on the server at all because the public keys are not generated using this key but derived from a master public key which is useless for spending funds.

So, op needs to be informed about HD wallets instead of being fooled by your irrelevant poor knowledge about hot wallets and cold wallets.


Title: Re: Storing private keys on servers
Post by: zaryabbkh on April 29, 2019, 04:57:42 AM
First of all lets see how Mnemonic based HD wallets works.

SEED:
time face caught jump pony myth only doll treat clog monitor verify fabric walnut permit

This is the SEED used to generate xpub and xpriv keys for multiple coins, this single key can generate both bitcoin and ethereum addresses and many more, like the hardware walelts Trezor do, 1 single seed is enough for every coin that you stored in your wallet.

BITCOIN XPUB KEY
xpub6DCsNLV4BriXeaACJBxX3ny7vNaegKcJU2W16NKmE6MS8DzXNWj9LgcH647tNhKKDj4GJsamvRR ScD2Sg3bw6JSwJcto4awVGdg5dPM1FTu

path,address,private key for BITCOIN

m/44'/0'/0'/0/0,
197ToSUz1fHUZw6RyayGHcVgAbeMxQu5MN,
L4FSbxSNQdEC32rrwv2CbxEbGeRxP2HrzT6G5JhRUvm6Jri1wp2K

m/44'/0'/0'/0/1,
1H8m2zVwMhEgKJRfDnWsoti1K2kN87x2ym,
L4b7grTtHEtahUNeDLesHTDShRbUTXHp5Jy3Cy4j1YZiVSwLRHXt

ETHEREUM XPUB KEY
xpub6CT1Ak6RQCF4YmYX8X5vKCWMMTp553Mj4LfYEgKidavurq3xcAwnWMspcnEbMz1GLVhqSwgkK7x Y9wqRCBBQieZ7ziRqT5dT6zWiVaga79c

path,address,private key for ETHEREUM

m/44'/60'/0'/0/0,
0xB4d5Eb0A4033770ad5b7076494F5e111BEf0e900,
0xa3ff08362024f18909c7845b38455b3e03ee47e5735977dccc2e50ef825ec1b5

m/44'/60'/0'/0/1,
0x04905Da51b6DDdE795C1890096dDbbfCe3039b0F,
0x81a2fd621dc67aafb6d42791b513a9318eafc01fb63b91afda41c1cd71fc5b21


The issue is ETHEREUM has account model which means every generated address private key is required to make a transaction where as bitcoin has UTXOs model in which we can select multiple UTXOs and make a transaction

197ToSUz1fHUZw6RyayGHcVgAbeMxQu5MN => 0.1 BTC
1H8m2zVwMhEgKJRfDnWsoti1K2kN87x2ym => 1 BTC

so in Bitcoin i can use all 1.01 BTC in a single transaction by just using a function getUTXOs() rest is done by Bitcoin wallet. BTCD or BITCORE gives this functionality.

0xB4d5Eb0A4033770ad5b7076494F5e111BEf0e900 => 0.1 ETH
0x04905Da51b6DDdE795C1890096dDbbfCe3039b0F => 1 ETH

in case of ethereum to use a total of 1.01ETH in my HD wallet i've to individually use both addresses private key to make a transaction and then executing a batch transaction will do the job.


So the problem is not HD wallets its about the architecture of both Bitcoin and Ethereum

I can use a single SEED and xpub key to generate unlimited addresses of ETHEREUM but i can't make transactions like BITCOIN i'll need the private key of all the generated addresses.

To automate the withdrawal process we have to store private keys on server else we've to do manual transaction

bob123 is saying the storage of private keys on server is inevitable in case of automatic withdrawals. but we can use HOT and COLD wallet mechanism to store some of our funds in HOT wallets that will be used for automated withdrawals and rest of our funds will be stored in a COLD wallet that is an offline wallet and not connected to internet. This will save us from hackers to stole all of our exchange funds only HOT wallets funds can be stolen.   


Title: Re: Storing private keys on servers
Post by: bob123 on April 29, 2019, 06:29:26 AM
[...] op claimed that HD wallets are not good because s/he was confused about what the concept is [...]

Where did OP say that ?

Maybe learn to read properly ? ..



If instead of trying to show-off you bother to read op's inquiry it is more than obvious that s/he is trying to handle thousands of private keys because s/he is not aware of HD wallets and the feasibility of having one master key and thousands of bitcoin addresses assigned to users, it is why s/he asks about the security of keeping track of so many private keys supposedly on a server using a database.

OP never mentioned anything about 'keeping track of private keys', but on how to store them securely.
Also.. how do you come to the conclusion that OP does not know what a HD wallet is  ??? He never mentioned anything which could lead to that conclusion.

Even with a HD wallet, you have to handle all private keys.

Good (and big) online services do not use a wallet software like electrum etc. to handle their keys. They build their own software (which obviously have to handle private keys..).



It is really crazy, you give irrelevant information about hot wallet/cold wallet stuff to a confused newbie and s/he says thank you, then somebody tries to really help and you are attacking him because you desperately need the credit?  :D

Irrelevant information ?
Sure, if you want to build an exchange or any other online service which handles funds of user, knowledge about hot-/cold- wallets is useless..

You didn't help at all. All you did was saying 'yo op, use HD wallet, it is best'.

It is a shame that you even dare to comment in this thread without having knowledge regarding the important parts of safely constructing a concept for OP needs..



Of course there is always a private key corresponding to a public key, the point with HD wallets is that you don't need to store the private keys like what op thinks instead your wallet software derives the corresponding private key from the master private key. You don't need to store this master private key on the server at all because the public keys are not generated using this key but derived from a master public key which is useless for spending funds.

You still don't understand what OP really wanted to know..



So, op needs to be informed about HD wallets instead of being fooled by your irrelevant poor knowledge about hot wallets and cold wallets.

HD wallets are not the solution. That's not what he asked. He does know how HD wallet works (see his last post).. thats completely not he topic here..

Using a HD wallet won't secure automatic withdrawals and won't protect against attacks, does it ?

So, instead of posting nonsense, please educate yourself before trying to 'help' other people.





bob123 is saying the storage of private keys on server is inevitable in case of automatic withdrawals. but we can use HOT and COLD wallet mechanism to store some of our funds in HOT wallets that will be used for automated withdrawals and rest of our funds will be stored in a COLD wallet that is an offline wallet and not connected to internet. This will save us from hackers to stole all of our exchange funds only HOT wallets funds can be stolen.   

Not necessarily.

You don't need the private keys stored on the server, you just need a route between your web server and a server which does handle the payouts.

A concept without storing any private keys on the web server would be, that you have a 'withdrawal-server' which has the private keys and queries your web server to get a current list of 'next withtdrawals'.
This is the server which creates the transactions / broadcasts them.

Or - similarly - the webserver creates unsigned transactions with the public keys and sends them to the 'withdrawal-server', which then signs and broadcasts them.


All of these possibilities include that there is a way for an attack to theoretically get transactions injected into the flow. So none of these is completely sure.
But this would be a concept to avoid private keys stored on the server and therefore against them being stolen.


Title: Re: Storing private keys on servers
Post by: aliashraf on April 29, 2019, 07:46:25 AM
[...] op claimed that HD wallets are not good because s/he was confused about what the concept is [...]

Where did OP say that ?

Maybe learn to read properly ? ..
OR may be you need to learn it:
Thanks bob123 for such a great clarification.

yeah the issue is I've to generate separate address for each user and in case of ethereum the hd wallets doesn't works like bitcoin where we can just select UTXOs and make a transaction.

bob123 gives the most optimal solution
It is where she applauded your irrelevant answer ignorantly and stated that hd wallets are not usefull because they don't work just like bitcoin! Obviously our newbie has read something (this is what newbies do) but her conclusion is absolutely wrong so she is going to make like thousands of key pairs (thanks to you) and figuring out how to save them! Ruining a cryptocurrency project probably in a third world country (again thanks to you and your desperate need for being applauded)
 

If instead of trying to show-off you bother to read op's inquiry it is more than obvious that s/he is trying to handle thousands of private keys because s/he is not aware of HD wallets and the feasibility of having one master key and thousands of bitcoin addresses assigned to users, it is why s/he asks about the security of keeping track of so many private keys supposedly on a server using a database.

OP never mentioned anything about 'keeping track of private keys', but on how to store them securely.
Also.. how do you come to the conclusion that OP does not know what a HD wallet is  ??? He never mentioned anything which could lead to that conclusion.
:o

it is the opening post of the topic:
Hi, I'm newbie in crypto world and working on a tranding platform. I've to generate separate addresses against every user and stuck at how to securely store the private keys. I've looked into the ecc encryption, AWS KMS, and hashicorp vault but the common thing among all the methods is, the decryption password or token is still stored on the server. So if the server got compromised everything is gone. Now my question is what is the best way to store the private keys. Thanks!  
See? OP thinks she has tons of private keys to save, she is a traditional web developer, she knows handling large numbers of data needs database services and servers and is worried about security of this scheme. This is a common pattern among newbies and I've encountered it a zillion times and without illiterate posters like you around I've always been helpful by introducing HD wallets to them and ensuring them there is no crisis at all and they need to keep just two keys safe master public key and master private key some more details and we are done.

In this case you distracted the user by discussing about an entirely irrelevant subject: cold vs hot wallets which was absolutely unnecessary. A typical  web application that is supposed to give its users bitcoin/crypto payment utilities does not have to handle refunds online at least in its first stages of development, there is no need to have any hot wallet at all!


Even with a HD wallet, you have to handle all private keys.

Good (and big) online services do not use a wallet software like electrum etc. to handle their keys. They build their own software (which obviously have to handle private keys..).
Irrelevant:
Your scenario is not applicable to all online services, most of them does not even need any form of hot wallet
Misinformation:
They don't keep track of 'private keys' there is just one private key to be kept secure for the hot wallet and it is not common case and is applicable to centralized exchange services and similar applications that are supposed to support withdraw/refund operations.

In the rest of your post you are rehashing your above claims wasting your and my time.


Title: Re: Storing private keys on servers
Post by: bob123 on April 29, 2019, 08:26:39 AM
[...] op claimed that HD wallets are not good because s/he was confused about what the concept is [...]

Where did OP say that ?

Maybe learn to read properly ? ..
OR may be you need to learn it:
Thanks bob123 for such a great clarification.

yeah the issue is I've to generate separate address for each user and in case of ethereum the hd wallets doesn't works like bitcoin where we can just select UTXOs and make a transaction.

bob123 gives the most optimal solution
It is where she applauded your irrelevant answer ignorantly and stated that hd wallets are not usefull because they don't work just like bitcoin! Obviously our newbie has read something (this is what newbies do) but her conclusion is absolutely wrong so she is going to make like thousands of key pairs (thanks to you) and figuring out how to save them! Ruining a cryptocurrency project probably in a third world country (again thanks to you and your desperate need for being applauded)

You are just delusional.

Even with a HD wallet, you HAVE TO GENERATE multiple private keys (1 per address).

You obviously don't understand anything at all.. You DO NOT sign transactions with your SEED.. for gods sake.. better stop posting for a few years and learn all the basic stuff you don't know yet..




If instead of trying to show-off you bother to read op's inquiry it is more than obvious that s/he is trying to handle thousands of private keys because s/he is not aware of HD wallets and the feasibility of having one master key and thousands of bitcoin addresses assigned to users, it is why s/he asks about the security of keeping track of so many private keys supposedly on a server using a database.

OP never mentioned anything about 'keeping track of private keys', but on how to store them securely.
Also.. how do you come to the conclusion that OP does not know what a HD wallet is  ??? He never mentioned anything which could lead to that conclusion.
:o

it is the opening post of the topic:
Hi, I'm newbie in crypto world and working on a tranding platform. I've to generate separate addresses against every user and stuck at how to securely store the private keys. I've looked into the ecc encryption, AWS KMS, and hashicorp vault but the common thing among all the methods is, the decryption password or token is still stored on the server. So if the server got compromised everything is gone. Now my question is what is the best way to store the private keys. Thanks! 
See? OP thinks she has tons of private keys to save, she is a traditional web developer, she knows handling large numbers of data needs database services and servers and is worried about security of this scheme. This is a common pattern among newbies and I've encountered it a zillion times and without illiterate posters like you around I've always been helpful by introducing HD wallets to them and ensuring them there is no crisis at all and they need to keep just two keys safe master public key and master private key some more details and we are done.


OP HAS TO generate multiple private keys.
A HD wallet just says HOW TO create them.. But you still need 1 per address.. Is that really that hard to understand ?!

The point is.. he wants to keep them SECURE.. not HOW he creates them.. 


You have been helpful ?  ;D
Name me a few web service which handle user funds where you 'helped' a newbie to set it up.. 

I'd love to start some penetration testing against those platforms.. probably wouldn't take more than a few hours to find severe vulnerabilities.. And you are the one to blame.




Even with a HD wallet, you have to handle all private keys.

Good (and big) online services do not use a wallet software like electrum etc. to handle their keys. They build their own software (which obviously have to handle private keys..).
Irrelevant:
Your scenario is not applicable to all online services, most of them does not even need any form of hot wallet
Misinformation:
They don't keep track of 'private keys' there is just one private key to be kept secure for the hot wallet and it is not common case and is applicable to centralized exchange services and similar applications that are supposed to support withdraw/refund operations.

In the rest of your post you are rehashing your above claims wasting your and my time.

I have never encountered such a large amount of nonsense in 1 person. You are a shame.

You can NOT SIGN transactions with your master private key.
You can derive your private keys from it, but you still need to use them to sign transactions..

So.. what do you do ? Create the private key, sign a transaction and delete it.. to 'not having to keep it'.. because of 'security' ?

Please stop being so delusional. Thats horrific. You don't have any clue on how to create a concept for an online service.
You probably can't even protect your own coins properly.



There is literally just 1 post from you which contains the truth:
I just filled all of the info and proved to be the foollest btctalk member ever.  I think it worth like 500 merits from theymos directly, I deserve legendary title because of it.  ;D ;D

This shows 1) how dumb you are and that you even know it and 2) that you are eager for merit.
That's not a good combination  ;D


Title: Re: Storing private keys on servers
Post by: aliashraf on April 29, 2019, 09:00:14 AM
[...] op claimed that HD wallets are not good because s/he was confused about what the concept is [...]

Where did OP say that ?

Maybe learn to read properly ? ..
OR may be you need to learn it:
Thanks bob123 for such a great clarification.

yeah the issue is I've to generate separate address for each user and in case of ethereum the hd wallets doesn't works like bitcoin where we can just select UTXOs and make a transaction.

bob123 gives the most optimal solution
It is where she applauded your irrelevant answer ignorantly and stated that hd wallets are not usefull because they don't work just like bitcoin! Obviously our newbie has read something (this is what newbies do) but her conclusion is absolutely wrong so she is going to make like thousands of key pairs (thanks to you) and figuring out how to save them! Ruining a cryptocurrency project probably in a third world country (again thanks to you and your desperate need for being applauded)

You are just delusional.

Even with a HD wallet, you HAVE TO GENERATE multiple private keys (1 per address).

You obviously don't understand anything at all.. You DO NOT sign transactions with your SEED.. for gods sake.. better stop posting for a few years and learn all the basic stuff you don't know yet.
Stop your personal attacks!
1- GENERATING is irrelevant, to generate a key we need a piece of code and the master private key, so we don't need to save/keep track of the corresponding private keys for addresses we have assigned to our users who have made deposits/payments.

2- Accessing funds deposited by users is out of scopes of most online services, hence it is typically unnecessary to have the master private key stored on the server at all.

Stop spreading misinformation to justify your thirst for credit, you made a mistake I corrected it, user is now focusing on what I said instead of your bullshits about hot wallets and cold wallets.

Just stop it, otherwise I'll report your actions as personal attack and vandalism.

OP HAS TO generate multiple private keys.
A HD wallet just says HOW TO create them.. But you still need 1 per address.. Is that really that hard to understand ?!

The point is.. he wants to keep them SECURE.. not HOW he creates them..  
generating keys is done with a piece of code and a master public key no need to keep anything SECURE, there is no private key even one in the whole server to be saved and kept secure.

Even with a HD wallet, you have to handle all private keys.

Good (and big) online services do not use a wallet software like electrum etc. to handle their keys. They build their own software (which obviously have to handle private keys..).
Irrelevant:
Your scenario is not applicable to all online services, most of them does not even need any form of hot wallet
Misinformation:
They don't keep track of 'private keys' there is just one private key to be kept secure for the hot wallet and it is not common case and is applicable to centralized exchange services and similar applications that are supposed to support withdraw/refund operations.

In the rest of your post you are rehashing your above claims wasting your and my time.

I have never encountered such a large amount of nonsense in 1 person. You are a shame.

You can NOT SIGN transactions with your master private key.
You can derive your private keys from it, but you still need to use them to sign transactions..

So.. what do you do ? Create the private key, sign a transaction and delete it.. to 'not having to keep it'.. because of 'security' ?

Please stop being so delusional. Thats horrific. You don't have any clue on how to create a concept for an online service.
You probably can't even protect your own coins properly.
Nobody said to sign a transaction directly by your master private key but it is what happens indirectly:

1- User makes a deposit to an address that you've generated by your master public key online and assigned to him.

2- You decide to spend it for some reason

3- You run your wallet software, supplying your unique seed and the address you wish to spend from

4- Your software derives corresponding private and public key, generates the transaction, relays it to the network, erases the keys from the memory and you are done!

I know for a frustrated person who is desperately obsessed with his credit it is so hard to read and understand anything but try your best. ;)

There is literally just 1 post from you which contains the truth:
I just filled all of the info and proved to be the foollest btctalk member ever.  I think it worth like 500 merits from theymos directly, I deserve legendary title because of it.  ;D ;D
;D

It was April's fool joke and we had fun, it is how you read my posts as a stalker?  ;D What's your IQ anyway?

EDIT:
It was more productive and helpful If you were arguing more politely and in a humble way, I think not only op but a lot of people who have not enough expertise in bitcoin and crypto technology have problems with keu management because they have no clue about how great HD wallets are. Most of these guys are very experienced in e-commerce and web application development and in most cases they simply need a simple integration of bitcoin as a payment system discussing hot/cold wallet issues with them is just wasting time and a distraction what they really need is a brief understanding of HD wallets.


Title: Re: Storing private keys on servers
Post by: bob123 on April 29, 2019, 09:15:34 AM
~snip~
generating keys is done with a piece of code and a master public key no need to keep anything SECURE, there is no private key even one in the whole server to be saved and kept secure.
~snip~

That's enough for everyone to see that you are talking about something, which you have no knowledge of at all.

You don't understand how one should develop a concept for automatic withdrawals.
You don't understand that security plays a huge role, regardless of whether private keys are stored on the server or not.
You don't understand that one can steal funds of a badly constructed web server which handles user funds even without any private key.
You don't understand that your 'approach' (if you really want to call it approach) is just inefficient and retarded.


So, stop talking about HD wallets. That was NEVER the topic in this thread.
I know that you unfortunately can't understand this.. But in this case, just start getting some basic knowledge first before trying to help people (which results in delusional bad posts with zero quality / relevance).



Title: Re: Storing private keys on servers
Post by: aliashraf on April 29, 2019, 09:47:04 AM
~snip~
generating keys is done with a piece of code and a master public key no need to keep anything SECURE, there is no private key even one in the whole server to be saved and kept secure.
~snip~

That's enough for everyone to see that you are talking about something, which you have no knowledge of at all.

You don't understand how one should develop a concept for automatic withdrawals.
You don't understand that security plays a huge role, regardless of whether private keys are stored on the server or not.{ ??? Are you joking?}
You don't understand that one can steal funds of a badly constructed web server which handles user funds even without any private key. { Joking again? stealing funds without keys? }
You don't understand that your 'approach' (if you really want to call it approach) is just inefficient and retarded.


So, stop talking about HD wallets. That was NEVER the topic in this thread.
I know that you unfortunately can't understand this.. But in this case, just start getting some basic knowledge first before trying to help people (which results in delusional bad posts with zero quality / relevance).


Automatic withdrawals is not the topic. It is what you know something about and you want to show-off with and has ruined the topic and distracted op for this.

Nobody has asked anything about user withdrawing funds ever! It is a trolling and show-off, what you are doing here.
Op is asking about a simple web application that assigns users addresses for their payments (invoices, ...) you deliberately distracted her to an irrelevant topic about hot vs cold wallets and now you are making excuses about it being about automatic withdrawals!

Who do you suppose op is? A centralized exchange developer? No! She is new to crypto, she got thousands of users and wants to assign them addresses (you don't assign addresses for withdrawals users do!), there is no glue to stick withdrawals to this topic.

Now try to overcome to your anger and realize what is going on here:
1- A newbie is confused about how to manage deposits/payments made by her users, concerned about saving/tracking/keeping secure corresponding private keys which she thinks their cardinality is the same as assigned addresses.

2- A person (Bob) with lots of merits comes and says nonsense about hot wallets and cold wallets which eventually he admits it is about automatic withdrawals!

3- The newbie says thank you to that person and is about to make the most tragic decision ever and ruining her project and bitcoin reputation in her local market.

4- Another person (Ali) with comparable rank intervenes and politely denounces Bob's recommendation as being helpful and gives the proper solution which is using a HD wallet properly.

5-Bob who is apparently very sensitive about his credit or hates Ali for some unknown reason, starts a shameful campaign against him to prove himself knowledgeable and Ali as being stupid or something.

How do you feel about this Bob?  ???


Title: Re: Storing private keys on servers
Post by: bob123 on April 29, 2019, 10:02:59 AM
Automatic withdrawals is not the topic. It is what you know something about and you want to show-off with and has ruined the topic and distracted op for this.

Nobody has asked anything about user withdrawing funds ever! It is a trolling and show-off, what you are doing here.


Well, you obviously didn't read the OP properly (or you are not able to understand what you read):

Hi, I'm  [...] working on a tranding platform. [...]  and stuck at how to securely store the private keys. I've looked into the ecc encryption [...]

Sure, i forgot.. trading platforms don't offer their user to withdraw their funds  ::)



Op is asking about a simple web application that assigns users addresses for their payments (invoices, ...) you deliberately distracted her to an irrelevant topic about hot vs cold wallets and now you are making excuses about it being about automatic withdrawals!

Yes. A trading platform which handles user funds is a 'simple web application'.  ;D ;D ;D
You do realize that a trading platform consists of more than just assigning address to users in a database?  ::)



Now try to overcome to your anger and realize what is going on here:
1- A newbie is confused about how to manage deposits/payments made by her users, concerned about saving/tracking/keeping secure corresponding private keys
2- A person (Bob) with lots of merits comes and says nosens about hot wallets and cold wallets which eventually he admits it is about automatic withdrawals!
3- The newbie says thank you to that person and is about to make the most tragic decision ever and ruining her project and bitcoin reputation in her local market.
4- Another person (Ali) with comparable rank intervenes and politely denounces Bob's recommendation as being helpful and gives the proper solution which is using a HD wallet properly.
5-Bob who is apparently very sensitive about his credit or hates Ali for some unknown reason, starts a shameful campaign against him to prove himself knowledgeable and Ali as being stupid or something.

How do you feel about this Bob?  ???

I feel like this:

Number 3)
He is going to ruin his project, because... he makes sure that all of his funds won't get stolen ? Or because.. he does secure his coins ?  ::)

Number 4) is retarded.
Because no one talked whether he generates the private keys randomly or using a seed (which makes it a HD wallet).
So the "another person" was just coming and posting off-topic shit noone cared about, showing off how slow-minded he is. No one was talking about HOW to create the private keys..

Number 5)
Bob is very sensitive about bullshit being posted by people who don't know what they are talking about (ali).


Also.. why are you so obsessed with these stupid merits  ???
You get merit for good posts.. why can't you just stop talking about merits? Is it because you are jealous that i am in the list of the most merited user on this forum - and you are not ?



Title: Re: Storing private keys on servers
Post by: aliashraf on April 29, 2019, 10:23:53 AM
Automatic withdrawals is not the topic. It is what you know something about and you want to show-off with and has ruined the topic and distracted op for this.

Nobody has asked anything about user withdrawing funds ever! It is a trolling and show-off, what you are doing here.


Well, you obviously didn't read the OP properly (or you are not able to understand what you read):

Hi, I'm  [...] working on a tranding platform. [...]  and stuck at how to securely store the private keys. I've looked into the ecc encryption [...]

Sure, i forgot.. trading platforms don't offer their user to withdraw their funds  ::)
Improve your attitude.

"A trading platform" used by a non-native English writer is not explicitly mentioning a cryptocurrency exchange. More importantly the problem for op is not how users withdraw (if ever) it is about how they deposit!

Op is worried about managing deposits, you are trying to cover the mess but you can't. Even with your weird scenariothat a person new to cryptocurrency is developing a centralized exchange (just because a non-native writer has used a loose term like trading platform) you should've noticed that what she is actually worried about: deposits/payments.

Otherwise and if it was about withdrawals why should op ever have mentioned anything about assigned addresses and private keys? Withdrawing funds by users how could ever be related to their deposit addresses?

Op is asking about a simple web application that assigns users addresses for their payments (invoices, ...) you deliberately distracted her to an irrelevant topic about hot vs cold wallets and now you are making excuses about it being about automatic withdrawals!

Yes. A trading platform which handles user funds is a 'simple web application'.  ;D ;D ;D
You do realize that a trading platform consists of more than just assigning address to users in a database?  ::)
No I don't realize  :D
An online shop that accepts bitcoin for instance is a simple application whether you believe it or not  :D
All you need is a HD wallet (off-line/cold), its master public key, a piece of code that derives addresses from this key, a database that keeps track of invoices and assigned addresses, a full node (preferably yours) that is regularly queried for pending invoices, and you are done!

The worst thing about your posts here is their effect on newbies: causing confusions that discourage people from adopting bitcoin by spreading misinformation about complexities that never exist.



Title: Re: Storing private keys on servers
Post by: bob123 on April 29, 2019, 11:15:23 AM
"A trading platform" used by a non-native English writer is not explicitly mentioning a cryptocurrency exchange. More importantly the problem for op is not how users withdraw (if ever) it is about how they deposit!

Op is worried about managing deposits, you are trying to cover the mess but you can't. Even with your weird scenariothat a person new to cryptocurrency is developing a centralized exchange (just because a non-native writer has used a loose term like trading platform) you should've noticed that what she is actually worried about: deposits/payments.

Otherwise and if it was about withdrawals why should op ever have mentioned anything about assigned addresses and private keys? Withdrawing funds by users how could ever be related to their deposit addresses?

Did i ever mention it is a cryptocurrency exchange ? No.
But 'trading platform' implies that something is being traded.

He never mentioned how to handle deposits. He asked how to securely manage private keys on an online server. You still seem to lack the ability to understand what it is all about.

The main goal of a web service which handles user funds is to secure those funds. All of your so-called 'help' (a.k.a 'use HD wallet OP bro') doesn't help at all and is - in the best case - just spam.



No I don't realize  :D

We know that already. You made that more than clear.



An online shop that accepts bitcoin for instance is a simple application whether you believe it or not  :D

A trading platform is not an online shop.
Please don't tell me that you don't even understand the difference between those two..


Since we are drifting off-topic too much and you simply don't understand the importance of security in a crypto-based trading platform, i will stop replying to you from now on.
It is not a help for anyone reading this thread, and neither are you able to learn from it.


Title: Re: Storing private keys on servers
Post by: aliashraf on April 29, 2019, 11:31:39 AM
Did i ever mention it is a cryptocurrency exchange ? No.
But 'trading platform' implies that something is being traded.

He never mentioned how to handle deposits. He asked how to securely manage private keys on an online server. You still seem to lack the ability to understand what it is all about.
You have the spirit, but it is not enough.

I'm not the one in the aggressive position who insults others just because they have refuted his argument but it is getting seriously crazy:

Why in the hell anybody should ask anything about managing private keys other than handling  deposits/payments made by users?  ???

Op says he has to generate thousands of addresses for users and is worried about saving corresponding private keys and you are saying it is not about deposits/payments? What the hell it could ever be about?

Users asking for withdrawals (if ever) has absolutely nothing to do with addresses generated for their deposits/invoices, is it that hard to understand?

I need an apology from your side for being rude and reckless, otherwise don't expect much respect from my side ever.

I think it just happens, we make comments and sometimes we are not exactly right (like when we don't read the question carefully), it is not good practice to bite peers just because they've slightly corrected us, I've never seen such a behavior in this forum. You are in the edge of getting promoted, behave like a legendary member not a troll, please.



Title: Re: Storing private keys on servers
Post by: jak3 on April 29, 2019, 11:50:10 AM
why will you even store your private keys on a server? why not a personal wallet. It's too obvious that no matter how strong a server is it can somehow get compromised and on the other hand a personal wallet on a phone or on the desktop is far more secure. servers store private keys for temporary reasons like for you so you can have a good user experiance. like trading or gambling on those servers, it is like your personal wallet on the server but yes for better security you have to take the security on your hands.