Web3 Hackathon 101: Crypto Wallet Basics
Crypto Wallet Basics
If you're a developer just starting out with blockchain development and building DApps, it's critical to understand the components that make up a crypto wallet. Wallets are how users will interact with your DApps & you'll utilize them to deploy your smart contracts. They are an necessity for every DApp and I commonly see people confuse some of these terms.
The main components of crypto wallets are explained below: the wallet itself, the account, the mnemonic phrase, the private key, and the public key. Below I explain what they are.
What's a Wallet?
A wallet, such as MetaMask, securely stores the private keys to your accounts so that you don’t have to manually input your private key every time to sign a transaction. You can think of your wallet as a password manager service like LastPass or Google's Password Manager that remembers & inputs the usernames and passwords to all of your accounts for you. Wallets are private key management services.
Always remember that wallets do not store your cryptocurrency; they store your keys! Your cryptocurrency exists on the blockchain in the same way that your physical cash allocated to your debit card exists in a vault or safe.
There are also different types of wallets: custodial and non-custodial. It's important to know the difference.
MetaMask is a non-custodial wallet, which means it does not know or have access to your private keys or mnemonic. Only you have knowledge of this information which means it's your job to protect & secure this information. MetaMask cannot help you if you suddenly forget your mnemonic phrase because they do not know.
A custodial wallet, such as Coinbase, means that they know your private key and mnemonic and you do not. They secure and manage your crypto for you. This is a service they provide to make managing crypto easier. The downside is that they have more control of "your" crypto than you do. You can utilize Coinbase Wallet, which is a non-custodial wallet option offered by Coinbase.
The bottom line is that you must use a non-custodial wallet because creating DApps requires knowledge of your private key and mnemonic information. Since a custodial wallet hides this information from you, the only option is to use a non-custodial wallet.
What's a Mnemonic?
A mnemonic can also be referred to as a Seed Phrase or a Secret Recovery Phrase. When you make a new wallet on MetaMask or any other non-custodial wallet service, you'll be given a 12-word, 18-word, or 24-word phrase. This mnemonic phrase is your key to your wallet and it's also used to generate the private keys of new accounts you create within your wallet.
Remember that you don't use your mnemonic phrase to send or receive crypto; instead, you use an account that has an associated public-private key pair.
When you want to restore your wallet on a new device, you must enter its mnemonic phrase & this will also restore your accounts that were generated with the same mnemonic phrase. As result, you only need to memorize your wallet's mnemonic phrase, not the private keys, because your mnemonic will generate all your existing accounts. If someone discovers your mnemonic, they will be able to steal all of your cryptocurrency across all of your accounts. You must never share your mnemonic.
What's an Account?
When you create a wallet, an account is created for you automatically. You can create additional accounts within your wallet using your wallet's mnemonic phrase which will generate a new public/private key pair. So an account is essentially a public/key pair. Similar to your Twitter Account which requires a username & password. Your account is your gateway to the blockchain ecosystem & is a vehicle to be able to participate in the ecosystem.
You can also import accounts from other wallets into your current wallet, these accounts are called imported accounts. So a wallet doesn't only contain accounts associated with it.
What's a Public Key?
A public key, also known as a blockchain address, is generated using your private key. Even though your public key is generated using your private key, someone who knows your public key cannot derive your private key.
This is possible because Elliptic Curve Cryptography performs mathematical operations on your private key that cannot be reversed. This isn't an absolute statement because nothing is ever truly "unhackable," but Elliptic Curve Cryptography ensures that it's almost impossible. Feel free to share your public key with whoever so that they may send you crypto!
You can also think of public keys as your username. It's a unique identifier so others can identify you on the Blockchain. Just like you have a username on Twitter so others can find you there. To recap, a public key is your username & a private key is your password. They are related to each other because both correspond to one account.
What's a Private Key?
The mnemonic phrase of your wallet is used to generate a private key for your account or multiple accounts. Your account's private key is made up of random letters and numbers and enables you to sign transactions as well as verify that you own this blockchain address. It's a key to having access & control of your crypto which is why you must never share your private key with anyone. Private keys function similarly to passwords in the same way that they grant you access to accounts you own such as your social media accounts.
Summary
Subscribe to my newsletter
Read articles from Dayana directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Dayana
Dayana
I am a developer who enjoys problem-solving & learning new technologies. Whenever I learn something cool, I like writing about it because it helps me become a better dev & hopefully it helps you too!