Bloom: What is a wallet?

Festival Labs
4 min readJun 19, 2021

--

We have something that looks like a USB stick, many different mobile apps, and some pieces of paper. What do they have in common? They are all types of wallets. In the blockchain and web3 space, we call a wallet any place where you keep cryptographic keys that you can use to sign transactions.

Paper Wallets

A paper wallet is the simplest. It has written on it your keys, most commonly a public and private key pair. The public key can be known to anyone and used to associate the wallet with funds. The public key is also a pseudonym, because it gets shared when you perform transactions so that others can verify the operations you have done. This verification is possible because of the private key.

In asymmetric cryptography, the private key is what you can use to cryptographically sign messages. The resulting signature could be something like an authorization to move funds for example. By sharing the signature and your public key, anyone can verify that your signature was signed by your private key without having to know what the private key is.

This is very important to keep in mind — anyone who has your private key can create a valid signature. It’s for this reason that the private key must be kept private at all times. The first rule of using a cryptographic wallet is do not share your private key.

So if you are using a paper wallet, anyone who reads that piece of paper has access to your private key and therefore the ability to sign messages on “your” behalf (really we should think of this as on behalf of your public key pseudonym).

For a longer term and more secure solution, you may decide to laminate that paper and put it in a safe, but you have to be mindful that you don’t write any of the characters incorrectly or in handwriting that you won’t be able to read later. You could also print out the key pair but there are attack vectors to consider: Is your printer connected to WiFi? Is the printer firmware secure?

Hardware Wallets

You might be thinking, why would anyone use a paper wallet? Though paper can get lost, wet, or wear over time, it can be a reasonable form of a wallet in the short term. For example, when you generate a cryptographic key pair online, you can write your keys on a piece of paper and then transfer those keys to a more secure form a storage like a USB stick. But you might as well skip the paper step entirely and just go from computer to USB. (Learn more about the dangers of paper wallets here: https://en.bitcoin.it/wiki/Paper_wallet)

Before we make that jump let’s close the loop on another problem. How can you generate the key pair on a computer securely? As you’ll see in the coding portions for this topic, it is fairly straightforward to write or use an existing script to generate your key pair, but you would still probably want to do it when you are not connected to the internet and not using any other applications on your computer. We can reduce the threat of your keys being comprised by not generating them on your computer at all. This brings us back to the USB stick.

You could store keys on an external flash drive or USB stick, or use devices like a Ledger or Trezor that look similar but come with integration features that allow you to sign transactions from the device. This class of wallets is called hardware wallets. This is a good option for storing your private key if you trust the hardware manufacturers.

A phone can also act as a hardware wallet, but again there are attack vectors to consider. Fortunately smart phone operating systems like Apple iOS have mechanisms for secure storage.

A secure enclave provides one such mechanism. It is a hardware based secure storage location that can be on mobile phones or computers. Apple devices that have Touch ID enabled also have secure enclaves. The most important property of a secure enclave is that keys can not go in or out. When an app makes use of the enclave, it requests that the enclave generate a cryptographic key pair, but the app never gets access to the key material. When it comes time to generate or verify signatures, the app makes a request to the enclave and sends the relevant data. The enclave then performs the signature or verification and sends back the results to the app [1].

It’s important for mobile wallets to be open source and auditable so that users can have confidence in the protection of their private keys. If an app is using a secure enclave it can determine some of the parameters around usage of the generated keys such as whether requests to the enclave can happen when the device is locked (which would be required if the app is using the key in the “background”) or if Touch Id authorization is required before signatures can be generated. These are important features to be aware of because they can have very different implications for the user experience and security of the wallet.

References

  1. https://developer.apple.com/documentation/security/certificate_key_and_trust_services/keys/storing_keys_in_the_secure_enclave

Consider joining Bloom — a blockchain and smart contract development program for women and genderqueer individuals. Get in touch with us on Twitter @bloomdevs and visit bloom.fstvl.io to learn more!

--

--

Festival Labs
Festival Labs

No responses yet