<blockquote>
  <p>I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.</p>
</blockquote>

<p>This is really not the place to learn. Even the most hardened Bitcoin services get attacked on a regular basis. </p>

<blockquote>
  <p>Using brainwallet, the process for account creation is this:</p>
</blockquote>

<p>"Brain wallets" are an incredibly easy way for users to lose all of their funds. It happens every day. Think your 8 word sentence is strong enough? Chances are that it's not, and there's at least three bots that will empty the wallet in seconds of it receiving funds. </p>

<blockquote>
  <p>Now, whenever a user wishes to spend a transaction on my site I am attempting to use brainwallet to send transactions.</p>
</blockquote>

<p>The code you're referencing is just a frontend for blockchain.info and the bitcoinjs library. </p>

<blockquote>
  <p>As a side note: is this a sound process for storing and transmitting data to the server?</p>
</blockquote>

<p>Blockchain.info uses this method for it's web wallet, but no, it's very unsafe and offers very little in the way of security. If your server is compromised, the keys still are. If you are malicious, you can just backdoor the client scripting and nobody would ever know. It is not secure, and a service using this type of system shouldn't be advertising itself as such. </p>

CC BY-SA 3.0
2013-09-29T22:52:45.013Z
The brainwallet code I linked is not an actual brain wallet, it's a javascript implementation of address generation and transaction creation/signing. I think that the security gained from storing an encrypted private key rather than a plaintext private key is significant. At the end of the day, if a user is going to use a webwallet, they'll choose blockchain.info over any competitor who has access to their private key in plaintext.
bvpx
CC BY-SA 3.0
2013-09-29T23:26:59.560Z
Blockchain.info **has** access to the private keys anyway, you would have to be a fool to believe otherwise. If not them, someone with root on their boxes, or someone at cloudflare, or the janitor at the datacenter. JavaScript based crypto, can not and will not ever be secure when the code protecting the data is being loaded from a possibly adversarial server. Even if there wasn't a backdoor (I'm not saying there is), any JS encryption is weak and slow, compounded by the fact that users choose bad passwords. Better to just forgo the veil of false security, and store the keys server side.
Anonymous
CC BY-SA 3.0
2013-09-29T22:21:36.257Z
2013-09-29T22:21:36.257Z
Anonymous
<p>I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.</p>

<p>I want to learn how to make a website where the database does not hold anyone's private data.</p>

<p>What client-side encryption and hashing algorithm should I use? What algorithm or process should I use to ensure that the users encrypted and hashed data is secure on the server?</p>

<p>Using <strong><a href="https://github.com/brainwallet/brainwallet.github.com" rel="nofollow">brainwallet</a></strong>, the process for account creation is this:</p>

<ol>
<li>The client creates a private key.</li>
<li>The user enters a username/password</li>
<li>The client encrypts the private key with a password. The client hashes the password and username. The client sends data to the server.</li>
<li>The server stores the hashed username/password and encrypted private key to the database.</li>
</ol>

<p>Now, whenever a user wishes to spend a transaction on my site, I am attempting to use brainwallet to send transactions. The process for this will be:</p>

<ol>
<li>The user types in a username and password.</li>
<li>The client sends a hashed username/password to the server.</li>
<li>The server responds with an encrypted private key for that user.</li>
<li>The client decrypts the private key with a password.</li>
</ol>

<p>As a side note: is this a sound process for storing and transmitting data to the server?</p>

<transactions><wallet><blockchain.info><e-wallet><encryption>
Storing an encrypted private key on a server
bvpx
# Storing an encrypted private key on a server

(Asked by: username_0 on 2013-09-29)

I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.

I want to learn how to make a website where the database does not hold anyone's private data.

What client-side encryption and hashing algorithm should I use? What algorithm or process should I use to ensure that the users encrypted and hashed data is secure on the server?

Using **[brainwallet](https://github.com/brainwallet/brainwallet.github.com)**, the process for account creation is this:

1. The client creates a private key.
2. The user enters a username/password
3. The client encrypts the private key with a password. The client hashes the password and username. The client sends data to the server.
4. The server stores the hashed username/password and encrypted private key to the database.

Now, whenever a user wishes to spend a transaction on my site, I am attempting to use brainwallet to send transactions. The process for this will be:

1. The user types in a username and password.
2. The client sends a hashed username/password to the server.
3. The server responds with an encrypted private key for that user.
4. The client decrypts the private key with a password.

As a side note: is this a sound process for storing and transmitting data to the server?

**Tags:** transactions, wallet, blockchain.info, e-wallet, encryption


---

## 1 answers

### Answer by username_1 on 2013-09-29. Score: 3

> I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.

This is really not the place to learn. Even the most hardened Bitcoin services get attacked on a regular basis.

> Using brainwallet, the process for account creation is this:

"Brain wallets" are an incredibly easy way for users to lose all of their funds. It happens every day. Think your 8 word sentence is strong enough? Chances are that it's not, and there's at least three bots that will empty the wallet in seconds of it receiving funds.

> Now, whenever a user wishes to spend a transaction on my site I am attempting to use brainwallet to send transactions.

The code you're referencing is just a frontend for blockchain.info and the bitcoinjs library.

> As a side note: is this a sound process for storing and transmitting data to the server?

Blockchain.info uses this method for it's web wallet, but no, it's very unsafe and offers very little in the way of security. If your server is compromised, the keys still are. If you are malicious, you can just backdoor the client scripting and nobody would ever know. It is not secure, and a service using this type of system shouldn't be advertising itself as such.

> **Comments:**
> **username_0**: The brainwallet code I linked is not an actual brain wallet, it's a javascript implementation of address generation and transaction creation/signing. I think that the security gained from storing an encrypted private key rather than a plaintext private key is significant. At the end of the day, if a user is going to use a webwallet, they'll choose blockchain.info over any competitor who has access to their private key in plaintext.  
> **username_1**: Blockchain.info **has** access to the private keys anyway, you would have to be a fool to believe otherwise. If not them, someone with root on their boxes, or someone at cloudflare, or the janitor at the datacenter. JavaScript based crypto, can not and will not ever be secure when the code protecting the data is being loaded from a possibly adversarial server. Even if there wasn't a backdoor (I'm not saying there is), any JS encryption is weak and slow, compounded by the fact that users choose bad passwords. Better to just forgo the veil of false security, and store the keys server side.  

---

