2

Let's say we have an ETH trading exchange where we employ BIP32/BIP44 to generate a unique wallet address for each user. For simplicity, each user uses the same wallet address (unique to each user) for all subsequent deposits/withdrawals.

For safety reasons, we have a hot/online wallet and a cold/offline wallet, where the hot/online wallet is handled by a service (say a NodeJS app) that only contains an extended public key and not the mnemonic/seed of the HD Wallet root node.

We also use the derivation path structure similar to BIP44

m / purpose' / coin_type' / account' / address_index

Question 1: Is it generally practised to let each user have a different account level node? Eg: User 1 has m/44'/20'/1, user 2 has m/44'/20'/2', etc.

Question 2: Assuming the above question is correct, should the account level key be hardened or not hardened?

From my (poor) understanding so far, If we use m/44'/20'/0 instead of m/44'/20'/0', we only need to the extended public key for m/44'/20' to generate deposit addresses for each user m/44'/20'/0, m/44'/20'/1, etc.

However if we use m/44'/20'/0', we need the extended private key for m/44'/20' to generate deposit addresses for each user, and this is less secure because if the extended private key on the online/hot wallet app is compromised instead of the extended public key, all the funds can be stolen.

Lastly, what is the best practice for implementing BIP32 in such an application (trading exchange, marketplace, etc)? Does the app that handles the wallet and holds the keys communicate via a REST/websockets/jobqueue method with the other services that accepts user input to request withdrawal/deposits?

1

For simplicity, each user uses the same wallet address (unique to each user) for all subsequent deposits/withdrawals.

Realistically, this wouldn't be the case - maybe for withdrawals but not for deposits as it gives away too much informations about the individual user. You should track balance by user in a different schema and use invoices to handle payments and withdrawals. The reason I bring this up is because you're asking what is general practice in Question 1.

Question 1: Is it generally practised to let each user have a different account level node? Eg: User 1 has m/44'/20'/1, user 2 has m/44'/20'/2', etc.

I wouldn't. This system not only links the money in the system, it also links who has how much money.

Question 2: Assuming the above question is correct, should the account level key be hardened or not hardened?

As you mentioned the derivation path is as such

m / purpose' / coin_type' / account' / change / address_index

This means the account depth should be hardened. Failure to do so will be an anomaly and if I put the master private key in a different wallet, different addresses will be generated. So the answer to your question is yes, it should be hardened.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.