Understanding Web3 Wallets with Covalent
- Get token balances for address
- Get ERC20 token transfers for address
What is a Web3 Wallet?
In Web3, a wallet is a digital store for cryptocurrencies and other digital assets. The word “store” can be confusing because, technically, these wallets don’t actually store your crypto assets, as those are stored on the blockchain, which is public. Instead, a Web3 wallet is a software program that provides the control for users to interact with the blockchain and manage their assets by sending, receiving, and keeping track of cryptocurrencies.
A wallet usually consists of a private key and a public address. The private key is a secret code that allows the owner of the wallet to access and control their assets, while the public address is a unique identifier that is used to receive transactions from other users.
Here is an analogy to better understand these concepts:
Imagine that you have a safe in your house that contains valuable items, such as jewelry or documents. The safe has a combination lock that can be opened with a secret code. The secret code is like a private key in a Web3 wallet - it allows you, as the owner of the safe, to access and control the contents of the safe.
Now imagine that you also have a mailbox outside your house. The mailbox has a unique address, such as "123 Main Street", that is used to identify your house and receive mail. The mailbox address is like a public address in a Web3 wallet - it is a unique identifier that is used to receive transactions from other users.
Just like you can use the combination to open the safe and access your valuable items, you can use the private key to access and control your cryptocurrency assets in a Web3 wallet. And just like you can use your mailbox address to receive mail from other people, you can use your public address to receive cryptocurrency transactions from other users.
Web3 wallets can be used for various digital assets, including cryptocurrencies such as Ether (ETH), Bitcoin (BTC) and others, and collectibles known as non-fungible tokens (NFTs) and other digital assets. A wallet is like an access card for Web3, and is typically required to interact with any decentralized applications (dApps).
What Data Does a Web3 Wallet Contain?
Aside from a user’s private keys and public wallet address, a Web3 wallet typically contains the following data:
Portfolio balance: The total amount of cryptocurrency or other digital assets that the wallet holds.
Transaction history: A record of all the transactions that have been made to and from the wallet.
Token contract addresses: The addresses of the smart contracts that represent the wallet's tokens.
Token balances: The amount of each token that the wallet holds.
Some Web3 wallets may include additional data, such as the user's name and other personal information.
Take these popular Web3 wallets, and observe the data they display to users.
Why Build a Web3 Wallet?
With many established Web3 Wallets in the space, what is the allure of building your own? Web3 is also known as the ‘Ownership Economy,’ which defines the culture around this new wave of technology. This culture is about users owning their own data and experience instead of trusting third parties with it. As a developer, it’s complete freedom. You can completely curate your own experience, and optionally share your innovations with others around you.
Here are some reasons why a developer might want to create a Web3 wallet:
Asset management: A developer might want to create a Web3 wallet to store and manage their own cryptocurrency and other digital assets, such as non-fungible tokens (NFTs).
A component of an application: A developer might want to create a Web3 wallet as part of an application that uses digital assets, such as a decentralized exchange or a gaming platform.
Experimentation: A developer might want to create a Web3 wallet to learn more about blockchain technology and its workings. Building a Web3 wallet is a great way to learn about this new technology and then be able to apply it to use cases later.
To buy and sell: A developer might want to create a Web3 wallet as part of a dApp that allows users to transact with digital assets, such as buying and selling goods or services.
Regarding facilitating transactions or writing to the blockchain, Covalent does not provide that service as it is a read-only API. For all the front-end needs, however, Covalent is the perfect choice to return all the necessary wallet data in just a few API calls.
So how difficult is it? Surprisingly easy. Covalent enables developers to create custom wallets with just a few lines of code.
What Wallet Data Does Covalent Provide?
Covalent provides access to data from a variety of different blockchains, including Ethereum, Binance Smart Chain, Polygon and many more. Some of the types of data that Covalent provides include:
Token balances: The amount of a particular token that an address holds.
Transaction history: A record of all the transactions that have been made to and from an address.
Token metadata: Information about a particular token, such as its name, symbol, and total supply. This is particularly useful for NFTs.
Smart contract data: Information about a smart contract's address, ticker symbols, and the event logs it emits.
Chain data: Information about each supported blockchain, such as
chain_idand their logos.
Covalent provides these data points through various API endpoints, which developers can use to build applications and services atop the blockchain.
The most relevant Covalent endpoints for building a Web3 wallet are the Balances suite of endpoints, particularly the
Get token balances for address.
|Display token balances (eg: everything in the Coinbase image above)|
|Display token balances, including NFTs and the associated images (eg: everything in the Phantom image above)|
|Display all wallet transfers|
Covalent vs. Other Blockchain Data Providers
Covalent provides a Unified API, which is a type of API that provides access to data from multiple different sources or platforms in a single, cohesive interface. This is different than other data providers in Web3, mainly RPC (Remote Procedure Call) providers. The Unified API makes it easier for developers to access data from various blockchains without working with multiple different APIs or integrating with multiple different systems. Simply changing the
chain_id or interchangeably the
chain-name parameter allows a user to make the exact same query across any supported blockchain. Supported networks and relevant chain information can be found on the Supported Networks page on our docs, or simply use the
Get all chains endpoint.
|Use Case||JSON RPC||Covalent|
|[Wallet] Balances of tokens in your wallet||✅ Get in multiple steps for each token||✅ Get in 1 step|
|[Wallet] Transactions in your wallet||❌ Not possible||✅ Get in 1 step|
|[Wallet] Get NFT Balances||❌ Prohibitively difficult||✅ Get in 1 step|
In conclusion, a wallet is like an access card to Web3, allowing users complete control over their assets and experience. Wallet data primarily consists of token balances in a portfolio view but can also contain NFT data, recent transactions and more. There are already many great options for people to view and transact their assets, but Web3 is like a playground for developers to curate and build whatever they want! Building a wallet could be a standalone project, something that’s integrated into another application, or just a fun way to learn. Covalent provides all the data developers need to experiment and build Web3 wallets in a simple, free and efficient way.
Ready to try building your own Web3 wallet? Here’s a guide to help you get started.