Cold storage: Difference between revisions

From Bitcoin Wiki
Jump to navigation Jump to search
Sgornick (talk | contribs)
m →‎See also: Appen description to entry.
Belcher (talk | contribs)
m Reverted edits by Ellipalwallet (talk) to last revision by Belcher
 
(36 intermediate revisions by 13 users not shown)
Line 1: Line 1:
'''Cold storage''' in the context of Bitcoin refers to keeping a reserve of Bitcoins offline.
'''Cold storage''' in the context of Bitcoin refers to [[Storing bitcoins|storing Bitcoins]] offline and spending without the [[private key]]s controlling them ever being online. This resists theft by hackers and malware, and is often a necessary security precaution especially dealing with large amounts of Bitcoin.


For example, a Bitcoin exchange typically offers an instant withdrawal feature, and might be a steward over hundreds of thousands of Bitcoins.  To minimize the possibility that an intruder could steal the entire reserve in a security breach, the operator of the website follows a best practice by keeping the majority of the reserve in ''cold storage'', or in other words, not present on the web server or any other computer. The only amount kept on the server is the amount needed to cover anticipated withdrawals.
For example, a Bitcoin exchange which offers an instant withdrawal feature, and might be a steward over hundreds of thousands of Bitcoins.  To minimize the possibility that an intruder could steal the entire reserve in a security breach, the operator of the website keeps the majority of the reserve in ''cold storage'', or in other words, not present on the web server or any other online computer. The only amount kept on the server is the amount needed to cover anticipated withdrawals in one day.


Methods of cold storage include keeping bitcoins:
Special-purpose [[hardware wallet]]s are also a kind of cold storage solution but this article will mostly deal with cold storage using general purpose computing hardware.
* On a USB drive or other data storage medium in a safe place (e.g. safety deposit box, safe)
* On a [[paper wallet]]
* On a bearer item such as a physical bitcoin.
* Online, but on encrypted media where the encryption key is offline.


'''Deep cold storage''' refers to keeping a reserve of Bitcoins offline, using a method that makes retrieving coins from storage significantly more difficult than sending them there.  This could be done for safety's sake, such as to prevent theft or robbery.
See [[Links to Storage Methods#Cold Storage Methods]] for a review of published cold storage methods.


Because Bitcoins can be sent to a wallet by anyone knowing the wallet address, it is trivial to put a wallet in cold storage but to keep a copy of the addresses needed to send funds to it.
== Conceptual How-to ==
# Set up an online computer which has an internet connection, and an offline computer which is securely [https://en.wikipedia.org/wiki/Air_gap_%28networking%29 airgapped].
# The offline computer must have bitcoin wallet software installed. Use the software to generate a wallet and write down its [[seed phrase]] on paper or another medium.
# Obtain the [[Deterministic wallet#Master public key|master public key]] of the wallet you just generated and transfer it to the online computer. Use it to create a watch-only wallet on the online computer.
# The watch-only wallet on the online computer can provide bitcoin [[address]]es used for receiving money, and can tell the user when [[transaction]]s are received and how many [[confirmation]]s they have.
# For spending have the watch-only wallet create an [[transaction]] without the signatures which makes it valid.
# Transfer the unsigned transaction to the offline computer and use the wallet software to sign the transaction.
# Transfer the now-fully-signed transaction to the online computer and broadcast it to the bitcoin network. The watch-only wallet will tell you when the transaction has [[confirmation]]s.


A simple example of deep cold storage is opening a safety deposit box and putting a USB stick containing an encrypted wallet file in it.  The public (sending) addresses can be used any time to send additional bitcoins to the wallet, but spending the bitcoins would require physical access to the box (in addition to knowledge of the encryption password).
== Setting up a secure offline computer ==


Deep cold storage would typically be used for holding large amounts of bitcoins, or for a trustee holding bitcoins on behalf of others. In such a case, additional precautions should be taken beyond a simple example of a single safety deposit box.
A good solution for making a secure offline computer is to buy an old, used laptop or phone built by a reputable manufacturer. Then completely wipe it, do not connect to the internet and install only an operating system and bitcoin wallet from a USB drive<ref>https://twitter.com/peterktodd/status/1078350142644731904</ref>.
* The box could be accessed by bank or maintenance personnel, so the contents of the box alone should not be sufficient to access the wallet.
 
* The box could be stolen or destroyed in a disaster, or the media could become unreadable, so the box should not contain the only copy of the wallet.
Another option is to use a live operating system as the offline computer. This option is perhaps less secure, as sophisticated malware may be able to survive the live OS boot, but the method may be more convenient.
* The trustee could die or become incapacitated.  If access to the wallet or knowledge of its location is lost, or encryption passwords are lost, the bitcoins are gone forever. Provisions should be made so that the box can be accessed by someone else as appropriate, including any encryption passwords.
 
For some people other attacks must be considered. Wiping a computer may not be enough to remove threats of HDD firmware reprogramming, BIOS reprogramming or any other memory which persists after a clean reinstallation of the system<ref>https://www.reddit.com/r/Bitcoin/comments/a8m031/proof_of_keys_proof_of_trust_bitcoin_independence/ecdz47t/</ref>.
 
If the offline and online computer are kept close together (in the same room) then theoretically information can still be transmitted past the air gap using certain sidechannels like: RF, audio, light, magnetic, thermal. For further details see the wikipedia article on [https://en.wikipedia.org/wiki/Air-gap_malware Air-gap malware]. For this reason it could be a good idea to keep the offline and online computers physically far apart, and unplug the power cable from the laptop so it runs on battery power only.
 
When signing a transaction on the offline computer, make sure that destination [[address]]es are really correct. Malware on the online computer could swap out the address with an address belonging to the attacker. It could even partially brute-force the [[address]]es so that a few of their characters match, so check the ''entire'' address.
 
== Wallet software ==
 
The wallet software used for cold storage must support watch-only wallets and offline signing. Ideally the online wallet would be backed by a [[full node]] for the [[Full node#Why should you use a full node wallet|privacy, security and validation benefits]].
 
== Transferring data between offline and online ==
 
Cold storage requires on transferring master public keys and partially-signed transactions between the offline and online computers. There are several methods to do this:
 
=== USB flash drive ===
 
The data can be stored on a USB flash drive and passed between the computers. The advantages are speed and convenience. A disadvantage is that the USB interface still has an attack surface. Sophisiticated malware used in cyberwarface such as [https://en.wikipedia.org/wiki/Stuxnet Stuxnet] and [https://en.wikipedia.org/wiki/2008_cyberattack_on_United_States agent.btz] used USB flash drives to cross an airgap. These kind of attacks may not be a concern if the aim is to secure smaller amounts.
 
The [https://en.wikipedia.org/wiki/SecureDrop SecureDrop] platform for securely leaking documents to journalists also uses USB drives for secure communication.
 
=== QR codes ===
 
The data can be encoded into QR codes and each computer can be equipped with a camera for scanning them. Advantages are speed and conveniance; QR codes are also believed to have a smaller attack surface than USB flash drives. A major disadvantage is that QR codes have size limits and so may not be able to encode larger bitcoin transactions, although the transactions could be split up into multiple chunks and recombined at the other end.
 
=== Transcribing by hand ===
 
This method involves displaying the data on screen and either 1) typing it with the keyboard of the other computer or 2) writing it down on paper and then typing into the other computer. The advantage is that any security issues of USB interfaces or cameras are completely avoided. The disadvantage is speed as this method is very very slow; bitcoin transactions can be tens of kilobytes in size and each character would need to be carefully copied without mistakes.
 
== Private key backup storage ==
 
This article only recommends using [[seed phrase]]s (possibly with [[Seed phrase#Two-Factor Seed Phrases|encryption]]) to store private key backups. Seed phrases written into metal or on paper support [[Deterministic wallet|deterministic wallets]] and encryption. As seed phrases use natural language words, they have excellent error correction. Words written in bad handwriting can often still be read. If one or two letters are missing or unreadable the word can often still be deduced. The word list that the seed phrase words are drawn from is carefully chosen so that the first four letters of each word are enough to uniquely identify it.
 
Other methods are discussed here for completeness.
 
Raw [[private keys]] written on a piece of paper:
* Anyone who can see it, can steal it.
* Handwriting can be hard to read or completely illegible, especially when mixing upper and lower-case letters.
* Human error in transcription can cause errors on end product, many private key formats can fail even if a single letter is transcribed incorrectly.
* Paper can rot, be torn, burn, or be smoke damaged.
* Doesn't support [[Deterministic wallet|deterministic wallets]], only a single keypair is stored.
Printed on a piece of paper:
* Anyone who can see it, can steal it
* Non-laser printer ink can run if paper gets wet
* The printer itself is a security risk - some have internet connections, wifi, and disk memory.
* Paper can rot, be torn, burn, or be smoke damaged
 
On laminated paper:
* Anyone who can see it, can steal it
* Lamination is prone or degradation over time and puncture or cuts that could allow moisture to get trapped in the paper and cause deterioration or rotting in some circumstances - store in cool dry place
* Can burn or be smoke damaged
* 'Fireproof' & 'Fire-resistant' boxes can help protect paper in a small house fire but be warned that they can sometimes fall apart in the fire and get wet if the fire is put out with water.
* Remember people can just carry out a small safe.
 
Engraved / etched/ ablated / stamped on a piece of metal:
* Anyone who can see it, can steal it
* Some metals can deteriorate or corrode, choose a good metal; also store your metal away from direct contact other metals. Some metals that are corrosion resistant have low melting points, are extremely expensive, or hard to machine.
* Metals can still deform or melt from heat, destroying any engraved SK. "Most house fires do not burn hotter than 1,200 degrees Fahrenheit. This temperature is typically associated with the hottest portion of a home, which is in the roof area. Homes that burn for longer than 30 minutes or consist of multiple levels sometimes burn at higher temperatures."
* You want to pick a metal that won't be destroyed by a fire. So magnesium, tin, and lead are all out as engraving materials.
Silver, gold, copper, brass, bronze, nickel, cobalt, would survive the housefire fire unmelted. Some Aluminium alloys can survive but you have to have the right ones. At around 1500° Steel and Nickel should be okay. Titanium is above the housefire range and so is tungsten, however tungsten rings are known to shatter due to the brittle nature of the very hard metal.  
 
Stored digitally on a computer:
* Computers can crash, making data recovery expensive
* Data can still technically be recovered after a system is abandoned by the user. In some cases data can be recovered after multiple overwriting attempts and physical destruction (as long as the attacker can get all or most the pieces) so if you copy files to a new computer and ditch the old one, be careful.
* Can burn or be smoke damaged
* A traditional hard disc drive can have data corrupted by powerful magnetic fields and can physically shatter
* A non-negligible amount of HDDs suffer from factory defects that will cause them to fail unexpectedly during their lifetime
* Accidents can happen that could result in loss of data
* Solid state drives (SSDs) will lose data if unpowered, they may last years before this becomes a problem but it is unwise to store long-term data in unpowered SSDs
* If connected to internet it is another attack vector and the safety is only as good as the encryption used; I don't know what I would recommend but it wouldn't be BitLocker. Someone could be trying to break into the computer constantly. Even with good encryption if the machine or location is compromised the key could be stolen as soon as it is decrypted.
* There are a lot of ongoing threats with computers, from 0-day exploits to firmware exploits and malicious USB cords
* External hdds are good for storage for a few years at least if stored properly
* If not connected to internet, safety is only as good as the physical protection encryption used; could someone break into the location and copy the data without anyone noticing?
 
Stored digitally on CD, floppy disk, laserdisc, or mini-disc
* Plastics break down over time and with exposure to heat, humidity, regular light, all sorts of chemicals, even the oxygen in the air. This can lead to the loss of your data when stored on a medium made of plastic or written/printed on plastic.
* Can burn or be smoke damaged
* Can be physically damaged, making data recovery expensive or even impossible
* Magnetic media (tapes, floppy disc) can be damaged by magnets
* Data can become difficult to recover if the software and/or hardware to decode is old, don't use proprietary formats
 
Stored digitally on a flash drive
* Can break and have to be physically repaired before use
* Rapidly changing magnetic fields (See MRIs) can damage the data stored on flash drives
* Can burn or be smoke damaged
* Can become corroded from salt water or some atmospheric conditions
* If they break apart, some lighting conditions can cause data corruption (you can also put them back together and often still get the data)
* Different devices are all different, even similar devices from the same production batch can be different. There are large quality differences in drives but I am assuming you aren't using these for anything but storage.
* There are some fake flash drives that look like they saved the data but you can't get it back later
* Flash drives are not advised for long term storage; they can be used as one part of a multi-medium-location-format plan.
 
 
== Comparison between [[multisignature]] and cold storage for security ==
 
Cold storage aims to reducing the chance of failure due to hackers or malware. [[Multisignature]] aims to avoid a single point of failure. It is entirely possible to combine the two techniques, and create cold storage [[multisignature]] wallets.


== See also ==
== See also ==
* [[How to import private keys]]
* https://bitzuma.com/posts/a-gentle-introduction-to-bitcoin-cold-storage/
* https://www.lopp.net/bitcoin-information/security.html
* [[BitKey]]
* [[How to set up a secure offline savings wallet]]
* [https://maxtaco.github.io/bitcoin/2014/01/16/how-jason-bourne-stores-his-bitcoin/ How Jason Bourne Stores His Bitcoins]
* [http://codinginmysleep.com/bitcoin-cold-storage-in-plain-english Bitcoin Cold Storage In Plain English] by David Perry
* [http://codinginmysleep.com/bitcoin-cold-storage-in-plain-english Bitcoin Cold Storage In Plain English] by David Perry
* [http://www.offlineaddress.com/?site=about#security-risk Security of private key] offlineaddress.com


==References==
<references />
[[Category:Introduction]]
[[Category:Introduction]]
[[Category:Security]]

Latest revision as of 12:31, 2 January 2021

Cold storage in the context of Bitcoin refers to storing Bitcoins offline and spending without the private keys controlling them ever being online. This resists theft by hackers and malware, and is often a necessary security precaution especially dealing with large amounts of Bitcoin.

For example, a Bitcoin exchange which offers an instant withdrawal feature, and might be a steward over hundreds of thousands of Bitcoins. To minimize the possibility that an intruder could steal the entire reserve in a security breach, the operator of the website keeps the majority of the reserve in cold storage, or in other words, not present on the web server or any other online computer. The only amount kept on the server is the amount needed to cover anticipated withdrawals in one day.

Special-purpose hardware wallets are also a kind of cold storage solution but this article will mostly deal with cold storage using general purpose computing hardware.

See Links to Storage Methods#Cold Storage Methods for a review of published cold storage methods.

Conceptual How-to

  1. Set up an online computer which has an internet connection, and an offline computer which is securely airgapped.
  2. The offline computer must have bitcoin wallet software installed. Use the software to generate a wallet and write down its seed phrase on paper or another medium.
  3. Obtain the master public key of the wallet you just generated and transfer it to the online computer. Use it to create a watch-only wallet on the online computer.
  4. The watch-only wallet on the online computer can provide bitcoin addresses used for receiving money, and can tell the user when transactions are received and how many confirmations they have.
  5. For spending have the watch-only wallet create an transaction without the signatures which makes it valid.
  6. Transfer the unsigned transaction to the offline computer and use the wallet software to sign the transaction.
  7. Transfer the now-fully-signed transaction to the online computer and broadcast it to the bitcoin network. The watch-only wallet will tell you when the transaction has confirmations.

Setting up a secure offline computer

A good solution for making a secure offline computer is to buy an old, used laptop or phone built by a reputable manufacturer. Then completely wipe it, do not connect to the internet and install only an operating system and bitcoin wallet from a USB drive[1].

Another option is to use a live operating system as the offline computer. This option is perhaps less secure, as sophisticated malware may be able to survive the live OS boot, but the method may be more convenient.

For some people other attacks must be considered. Wiping a computer may not be enough to remove threats of HDD firmware reprogramming, BIOS reprogramming or any other memory which persists after a clean reinstallation of the system[2].

If the offline and online computer are kept close together (in the same room) then theoretically information can still be transmitted past the air gap using certain sidechannels like: RF, audio, light, magnetic, thermal. For further details see the wikipedia article on Air-gap malware. For this reason it could be a good idea to keep the offline and online computers physically far apart, and unplug the power cable from the laptop so it runs on battery power only.

When signing a transaction on the offline computer, make sure that destination addresses are really correct. Malware on the online computer could swap out the address with an address belonging to the attacker. It could even partially brute-force the addresses so that a few of their characters match, so check the entire address.

Wallet software

The wallet software used for cold storage must support watch-only wallets and offline signing. Ideally the online wallet would be backed by a full node for the privacy, security and validation benefits.

Transferring data between offline and online

Cold storage requires on transferring master public keys and partially-signed transactions between the offline and online computers. There are several methods to do this:

USB flash drive

The data can be stored on a USB flash drive and passed between the computers. The advantages are speed and convenience. A disadvantage is that the USB interface still has an attack surface. Sophisiticated malware used in cyberwarface such as Stuxnet and agent.btz used USB flash drives to cross an airgap. These kind of attacks may not be a concern if the aim is to secure smaller amounts.

The SecureDrop platform for securely leaking documents to journalists also uses USB drives for secure communication.

QR codes

The data can be encoded into QR codes and each computer can be equipped with a camera for scanning them. Advantages are speed and conveniance; QR codes are also believed to have a smaller attack surface than USB flash drives. A major disadvantage is that QR codes have size limits and so may not be able to encode larger bitcoin transactions, although the transactions could be split up into multiple chunks and recombined at the other end.

Transcribing by hand

This method involves displaying the data on screen and either 1) typing it with the keyboard of the other computer or 2) writing it down on paper and then typing into the other computer. The advantage is that any security issues of USB interfaces or cameras are completely avoided. The disadvantage is speed as this method is very very slow; bitcoin transactions can be tens of kilobytes in size and each character would need to be carefully copied without mistakes.

Private key backup storage

This article only recommends using seed phrases (possibly with encryption) to store private key backups. Seed phrases written into metal or on paper support deterministic wallets and encryption. As seed phrases use natural language words, they have excellent error correction. Words written in bad handwriting can often still be read. If one or two letters are missing or unreadable the word can often still be deduced. The word list that the seed phrase words are drawn from is carefully chosen so that the first four letters of each word are enough to uniquely identify it.

Other methods are discussed here for completeness.

Raw private keys written on a piece of paper:

  • Anyone who can see it, can steal it.
  • Handwriting can be hard to read or completely illegible, especially when mixing upper and lower-case letters.
  • Human error in transcription can cause errors on end product, many private key formats can fail even if a single letter is transcribed incorrectly.
  • Paper can rot, be torn, burn, or be smoke damaged.
  • Doesn't support deterministic wallets, only a single keypair is stored.

Printed on a piece of paper:

  • Anyone who can see it, can steal it
  • Non-laser printer ink can run if paper gets wet
  • The printer itself is a security risk - some have internet connections, wifi, and disk memory.
  • Paper can rot, be torn, burn, or be smoke damaged

On laminated paper:

  • Anyone who can see it, can steal it
  • Lamination is prone or degradation over time and puncture or cuts that could allow moisture to get trapped in the paper and cause deterioration or rotting in some circumstances - store in cool dry place
  • Can burn or be smoke damaged
  • 'Fireproof' & 'Fire-resistant' boxes can help protect paper in a small house fire but be warned that they can sometimes fall apart in the fire and get wet if the fire is put out with water.
  • Remember people can just carry out a small safe.

Engraved / etched/ ablated / stamped on a piece of metal:

  • Anyone who can see it, can steal it
  • Some metals can deteriorate or corrode, choose a good metal; also store your metal away from direct contact other metals. Some metals that are corrosion resistant have low melting points, are extremely expensive, or hard to machine.
  • Metals can still deform or melt from heat, destroying any engraved SK. "Most house fires do not burn hotter than 1,200 degrees Fahrenheit. This temperature is typically associated with the hottest portion of a home, which is in the roof area. Homes that burn for longer than 30 minutes or consist of multiple levels sometimes burn at higher temperatures."
  • You want to pick a metal that won't be destroyed by a fire. So magnesium, tin, and lead are all out as engraving materials.

Silver, gold, copper, brass, bronze, nickel, cobalt, would survive the housefire fire unmelted. Some Aluminium alloys can survive but you have to have the right ones. At around 1500° Steel and Nickel should be okay. Titanium is above the housefire range and so is tungsten, however tungsten rings are known to shatter due to the brittle nature of the very hard metal.

Stored digitally on a computer:

  • Computers can crash, making data recovery expensive
  • Data can still technically be recovered after a system is abandoned by the user. In some cases data can be recovered after multiple overwriting attempts and physical destruction (as long as the attacker can get all or most the pieces) so if you copy files to a new computer and ditch the old one, be careful.
  • Can burn or be smoke damaged
  • A traditional hard disc drive can have data corrupted by powerful magnetic fields and can physically shatter
  • A non-negligible amount of HDDs suffer from factory defects that will cause them to fail unexpectedly during their lifetime
  • Accidents can happen that could result in loss of data
  • Solid state drives (SSDs) will lose data if unpowered, they may last years before this becomes a problem but it is unwise to store long-term data in unpowered SSDs
  • If connected to internet it is another attack vector and the safety is only as good as the encryption used; I don't know what I would recommend but it wouldn't be BitLocker. Someone could be trying to break into the computer constantly. Even with good encryption if the machine or location is compromised the key could be stolen as soon as it is decrypted.
  • There are a lot of ongoing threats with computers, from 0-day exploits to firmware exploits and malicious USB cords
  • External hdds are good for storage for a few years at least if stored properly
  • If not connected to internet, safety is only as good as the physical protection encryption used; could someone break into the location and copy the data without anyone noticing?

Stored digitally on CD, floppy disk, laserdisc, or mini-disc

  • Plastics break down over time and with exposure to heat, humidity, regular light, all sorts of chemicals, even the oxygen in the air. This can lead to the loss of your data when stored on a medium made of plastic or written/printed on plastic.
  • Can burn or be smoke damaged
  • Can be physically damaged, making data recovery expensive or even impossible
  • Magnetic media (tapes, floppy disc) can be damaged by magnets
  • Data can become difficult to recover if the software and/or hardware to decode is old, don't use proprietary formats

Stored digitally on a flash drive

  • Can break and have to be physically repaired before use
  • Rapidly changing magnetic fields (See MRIs) can damage the data stored on flash drives
  • Can burn or be smoke damaged
  • Can become corroded from salt water or some atmospheric conditions
  • If they break apart, some lighting conditions can cause data corruption (you can also put them back together and often still get the data)
  • Different devices are all different, even similar devices from the same production batch can be different. There are large quality differences in drives but I am assuming you aren't using these for anything but storage.
  • There are some fake flash drives that look like they saved the data but you can't get it back later
  • Flash drives are not advised for long term storage; they can be used as one part of a multi-medium-location-format plan.


Comparison between multisignature and cold storage for security

Cold storage aims to reducing the chance of failure due to hackers or malware. Multisignature aims to avoid a single point of failure. It is entirely possible to combine the two techniques, and create cold storage multisignature wallets.

See also

References