Custodial vs Non-custodial wallets in DLT
Tags: blockchain, security, eth, cryptography
Published: 2021-08-04 14:06:17

This post will illustrate the differences between custodial and non-custodial cryptocurrency wallets and why a web3 developer needs one. This concept is vital for users of the decentralized web.

## Wallet overview

It is critical to understand the cryptography that defines cryptocurrency wallets. You don't need to understand all the math of the elliptic curve (although I recommend it because it is interesting); you need to understand the function of your private and public keys. I go over this in detail [here](https://dev.to/0xjepsen/an-introduction-to-cryptography-in-distributed-ledger-technology-268l). To summarize, your private key is used to authorize your transactions and receive information. Whoever has the private key of a wallet can access funds and authorize transactions. The private key is critical. The public key is hashed and then used as your wallet address. 

## Why do web3 developers need wallets?

To programmatically interact with decentralized networks, you must send and receive information to the network. Crypto wallets are how you do this. While people primarily use them for storing cryptocurrency, as a developer, you need them to deploy any services on a distributed ledger, i.e., [smart contracts](https://docs.soliditylang.org/en/v0.4.24/introduction-to-smart-contracts.html) or [Hedera's API](https://docs.hedera.com/guides/docs/hedera-api). While anyone can read a public distributed ledger, no one can transact on a distributed ledger without a wallet. The wallet serves you an anonymous identifier. Anonymity is taken seriously in some web3 dev communities, and developers are known by their public key. Hence the phrase: "see you on-chain."

Fun Fact: Wallets with leading zeros use less gas when storing information because there is less memory required to keep these values. You can find more information [here](https://medium.com/coinmonks/on-efficient-ethereum-addresses-3fef0596e263). As a result, you may see web3 developers online where their handles are the first few digits of their public key. The public key serves as proof of their activity on-chain since anyone can use a network explorer to view the activity associated with a public key. If you are interested in generating your vanity wallet, check out this [GitHub repository](https://github.com/MyEtherWallet/VanityEth).

## Wallet Providers

It is helpful to think of wallet providers as a window that allows you to easily view and interact with your wallet. Most wallets providers you have probably interacted with have a convenient user interface like Exodus, Atomic, or Metamask, allowing you to sign transactions and send cryptocurrency with a click of a button. However, it is essential to know that your wallet is provider agnostic, meaning that once it is created, you can view and interact with it from any wallet software as long as you have the corresponding private key. 

## Custodial

A custodial wallet is managed by a third party like a centralized exchange. The third-party handles your private key and authorizes your transactions for you. This is fine as long as you trust them to do so. The benefits lean towards non-technical users who don't want to keep track of private keys. The drawback is that there is an inherent risk in trusting a third party to manage all your crypto assets. Centralized exchanges have been victims of cyberattacks in the past, compromising their user's keys and crypto.

## Non-custodial

A non-custodial wallet is a wallet in which the user manages the keys. This is preferred by crypto-punks, security advocates, and the greater decentralized community. Non-custodial wallets put the responsibility on the user. If the user forgets their private key, no one can get it back for them. When you manage your keys, you don't have to put your trust in a third party. It is crucial that you keep your private key safe and that you never share it with anyone.

## Conclusion

In retrospect there are pros and cons of both wallet solutions. This is a very important decision for a developer to make. I personally utilize non-custodial wallets, but the decision is yours to make.