“保护你的钱包”的版本间的差异

来自Bitcoin Wiki
跳转至: 导航搜索
(以内容“==简介== 安全的钱包可以做到以下两点: # 保护你的钱包不会遗失。 # 保护你的钱包不被偷窃。 在当前情况下,你的钱包还没有...”创建新页面)
 
第14行: 第14行:
 
The wallet contains a pool of queued keys. By default there are 100 keys in the keypool.  The size of the pool is configurable using the undocumented "--keypool" command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.
 
The wallet contains a pool of queued keys. By default there are 100 keys in the keypool.  The size of the pool is configurable using the undocumented "--keypool" command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.
  
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.
+
创造一个新的地址可以产生一对新的公共和私人钥匙添加在你的钱包中。 每一对钥匙都是随机的数字,所以在产生之前都不可预知。如果你备份你的钱包然后创造超过一百个地址,每对钥匙都会和最新的地址有联系并且不在老的钱包中因为没对钥匙只有在创造后才能知道。任何从这些地址收到的钱将会遗失如果你从备份恢复了你的钱包。
  
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient's public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.
+
因为接收的地址显示在UI中不只有唯一的地址,所以形势就变得较为混乱。每个Bitcoin都有一个新的公钥,而且,更重要的是,各派出交易还发送回新的钥匙给自己。当发送Bitcoins给任何人,你为自己生成一个新的密钥对,并同时发送Bitcoins到新的公钥和实际收件人的公钥。这是一个不愿透露姓名的功能- 它使跟踪Bitcoin交易要困难得多。
  
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.
+
所以如果你备份了, 做了一百件事一上就会产生一个新的钥匙, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.
  
 
== Making a new wallet ==
 
== Making a new wallet ==

2011年2月22日 (二) 12:40的版本

简介

安全的钱包可以做到以下两点:

  1. 保护你的钱包不会遗失。
  2. 保护你的钱包不被偷窃。

在当前情况下,你的钱包还没有充分得到保护(因为你的在线密码太简单):

  1. 弄一个新的安全的钱包, 用更为复杂的密。

技术背景

Bitcoin交易发送Bitcoins到特定的公共密钥。Bitcoin地址是一个公共密钥散列编码。为了使用收到Bitcoins,你需要收到有匹配的私钥的公钥。这像一个超级密码的帐户(公钥)关联排序。您的Bitcoin钱包包含您收到的消费交易所有必要的私钥。如果你没有备份删除你的钱包,你就没有权利去授权相关信息来要回你的钱包,你也将失去了与这些密钥相关的硬币。

The wallet contains a pool of queued keys. By default there are 100 keys in the keypool. The size of the pool is configurable using the undocumented "--keypool" command line argument. When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.

创造一个新的地址可以产生一对新的公共和私人钥匙添加在你的钱包中。 每一对钥匙都是随机的数字,所以在产生之前都不可预知。如果你备份你的钱包然后创造超过一百个地址,每对钥匙都会和最新的地址有联系并且不在老的钱包中因为没对钥匙只有在创造后才能知道。任何从这些地址收到的钱将会遗失如果你从备份恢复了你的钱包。

因为接收的地址显示在UI中不只有唯一的地址,所以形势就变得较为混乱。每个Bitcoin都有一个新的公钥,而且,更重要的是,各派出交易还发送回新的钥匙给自己。当发送Bitcoins给任何人,你为自己生成一个新的密钥对,并同时发送Bitcoins到新的公钥和实际收件人的公钥。这是一个不愿透露姓名的功能- 它使跟踪Bitcoin交易要困难得多。

所以如果你备份了, 做了一百件事一上就会产生一个新的钥匙, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.

Making a new wallet

In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.

For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised. Just re-encrypting isn't secure. One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).

Making a secure workspace

Linux

The first step is to make a new user, so type:

sudo adduser new_user_name

when you get to the prompt 'Enter the new value, or press ENTER for the default', just keep hitting ENTER.

Then switch user to the new user. To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the 'System/Quit' screen, or if there is no switch icon on your system you can log out and log back in as the new user. Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.

For secure browsing, open Firefox, and then go into the Edit menu and click Preferences. Starting from the left, click on the General tab, and in the 'Startup/When Firefox starts' pop up menu, choose 'Show a Blank Page'. Then click on the Content tab, and deselect 'Load images automatically' and deselect 'Enable Javascript'. Then click on the Privacy tab, and in the 'History/Firefox will' pop up menu, choose 'Never remember history'. Then click on the Security tab, and in the Passwords section, deselect 'Remember passwords for sites' and deselect 'Use a master password'. Then click on the Advanced tab, then click on the Update tab, and then in the 'Automatically check for updates to' section, deselect 'Add-ons' and 'Search Engines'.

When javascript is disabled, the linux download page will not download automatically, so you'll have to click on the 'direct link' part of the "Problems with the download? Please use this 'direct link' or try another mirror." line.

After you've made your secure new user, to maintain security you should use it only for bitcoin.

Locating BitCoin's data directory

Windows

Go to Start -> Run (or press WinKey+R) and run this:

explorer %APPDATA%\BitCoin

BitCoin's data folder will open. For most users, this is the following locations:

C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)

C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)

"AppData" and "Application data" are hidden by default.

Linux

By default BitCoin will put its data here:

~/.bitcoin/

You need to do a "ls -a" to see directories that start with a dot.

If that's not it, you can do a search like this:

find / -name wallet.dat -print 2>/dev/null

Mac

By default BitCoin will put its data here:

~/Library/Application Support/Bitcoin/

Backup

The only file you need to back up is "wallet.dat". Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.

You can use the backupwallet JSON-RPC command to back up without shutting down Bitcoin.

General Solutions

Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.

  • 7-zip - Supports strongly-encrypted archives.
  • AxCrypt
  • TrueCrypt - Volume-based on-the-fly encryption (for advanced users)
  • WinRar - Commonly used archive software that supports verification records and encryption.

There is also a list of open source encryption software.

Password Strength

Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is at least 12 characters long.

If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.

Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.

Storage of Archive

One of the most simple places to store a appropriately encrypted archive of your wallet.dat file is to email yourself the archive. Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely. One can even encrypt the name of the files withing the archive, and name the archive something less inviting, such as: 'personal notes' or 'car insurance'.

Another solution is to use a file storage service like Dropbox and others, including the more secure SpiderOak.

Linux solution

Linux users can setup cron by running 'crontab -e' and adding this line:

 01 */1 * * * /usr/local/bin/backupwallet.sh

This cron line runs backupwallet.sh at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won't run.

backupwallet.sh:

 #!/bin/bash
 
 TS=$(date "+%Y%m%d-%H-%M")
 WALLET=/tmp/wallet${TS}
 WALLET_E=/tmp/wallet${TS}.crypt
 
 if
   echo -n making backup...
   bitcoind backupwallet $WALLET 
   ! -s "$WALLET" 
 then echo failed
 elif
   echo done
   echo -n encrypting....
   ! gpg -r myusername --output $WALLET_E --encrypt $WALLET
 then echo failed
 elif
   echo done
   echo -n copying to distant server...
   ! scp $WALLET_E user@myserver.org:~/wallets/
 then echo failed
 else echo done
 fi
 
 rm -f $WALLET $WALLET_E

The shell script:

  • Calls bitcoind backupwallet to create a time/date-stamped wallet.
  • GPG encrypts the wallet with your public key.
  • Copies the result to a backup location.

Restore

Assuming your backup is recent enough that you haven't used up all of your keypool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:

  • Quit bitcoin(d).
  • Copy your backed up wallet.dat into your bitcoin profile directory.
  • If copying into existing profile, delete file blkindex.dat, to make the client rescan the block chain.

And you'll be good as new.

Erasing Plain Text Wallets

A good practice is to keep at least two wallets, one as a "current account" for everyday transactions and one as a "savings account" where you store the majority of your Bitcoins.

The "savings account" wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your "current account" wallet.

In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will not generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.

The Linux shred command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover. Using shred (and similar tools on Windows) however does not guarantee that still other copies don't exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your filesystem, duplicating your wallet.dat.

For Windows, the built-in command cipher /w will shred all previously-deleted files. CyberShredder can securely deleted individual files.

eWallet

Storing bitcoins with an eWallet provider incurs risks as well.

See Also