Understanding Wallets

One of the most used web3 applications is Wallets. A crypto wallet is the gateway for interacting with web3 apps. Wallet controls access to the user’s money, tracks balance, manages keys and addresses, creates and signs transactions. A common misconception is that wallets store crypto coins. Wallets do not store the coins, but the blockchain does or rather the coins are recorded on a blockchain. Wallets contain only the user’s keys. But how can you control your coins on the blockchain network using a wallet? And what are keys?

Digital Signatures

Think of a digital signature as an alphanumeric string of random length. The key idea here is that digital signatures can be verified by anybody using what we call a public key. But, they can be created only by the one who has access to what we call a private or secret key. Public and private keys are created in pairs using mathematical algorithms. For example, you can create a public-private key pair, store the private key safely by memorizing it or writing it on a piece of paper and keeping it in a safe and private place and publish the public key so anybody can use it to verify signatures created by you. Now, you can use your private key to create signatures and anybody can verify that you own the private key by verifying your signature using the public key.

Transactions

When you buy $10 worth of Bitcoin on a crypto exchange like Coinbase or Binance, it is recorded on the bitcoin’s blockchain. Specifically, a record is made on the blockchain against your public key updating that public key’s balance by increasing it by $10 worth of bitcoin. When you want to spend that bitcoin, you create a transaction.

In simple terms, a transaction tells the blockchain network that the owner of the coins has authorized the transfer of value to a recipient. And the way the owner authorizes the transfer is by signing the transaction using their private key. All the nodes on the blockchain network can verify the ownership of these coins using the owner’s public key and also validating the balance of this public key on the blockchain.

Back to Wallets

Now that we understand what public and private keys are and what a transaction is, I hope it makes sense when we think of wallets as a secure storage for keys. In general wallets store both the public and private key. But it is enough to just store the private key and the public key can be derived from the private key.

Public keys are used as the address of the wallet. For example, the 0x163…42a6you see in the below image is actually the public key. It can be used for receiving crypto currencies from other addresses.

Screenshot of the popular Metamask wallet - https://metamask.io/
Screenshot of the popular Metamask wallet - https://metamask.io/

One of the interesting features of wallets is it can be used for creating multiple accounts or rather multiple public-private key pairs. Using a different public key for each transaction is generally a good practice if you want privacy in the sense that no two transactions can be traced back to the same public address.

Types of Wallets

There are two kinds of wallets

  • Non-Deterministic
  • Deterministic

Non-deterministic wallets store a collection of randomly generated private keys(corresponding public keys can be derived from the private keys). The biggest downside of these wallets is that they are cumbersome to manage, backup or import. If you generate a lot of random keys, they have to be backed up and kept safely. If a key is lost, the associated funds are lost forever.

Deterministic wallets are the most popular ones nowadays. These wallets use a seed for deriving all the private keys using a one way hash function. As long as the seed is backed up and kept safely, all the associated private keys that were generated during the lifetime of the wallet can be recovered. If you have used a MetaMask or a Coinbase wallet, there’s a good chance you have seen a seed. They are a generally represented as a group of random words that look like the one shown in the image below.

MetaMask Seed
MetaMask Seed

Wallets like MetaMask and Coinbase that have a group of random words or mnemonics as seed are also called as HD wallets or Hierarchical Deterministic wallets.

Hardware Wallets

There are special kinds of wallets that look like a USB device. These are called hardware wallets. They can perform almost all the functions software wallets can with the added advantage of better security. Transactions can be signed directly on the device, less chances of software vulnerabilities that can exploit software wallets and also you can pretty much carry your funds with you in your pocket with a hardware wallet. The most popular ones are Ledger and Trezor.

I hope this post was informative and useful for understanding wallets from both technical and usability perspective.

Subscribe to 0x7707…3C20
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.