I'm working with my metamask wallet to interact with my DApp. While reading about data in Ethereum, I read that the blocks in the chain do not store any account information. It will have only transaction details. So when we create a new account with practically no transaction, how come it shows up in the EtherScan? Is creating a new account a transaction in the blockchain? If so, does it consumes gas?
2 Answers
nice to meet you.
In Ethereum, creating a new account is not a transaction and doesn't consume gas because it happens off-chain on your device.
Your new account shows up on Etherscan because it's a public address that can be derived from your private key.
However, this new account won't have a transaction history until it interacts with the Ethereum network, for instance, by sending or receiving Ether or interacting with a smart contract. These actions are transactions and do consume gas.
Thanks.
Dev Advocate at Chainstack here!
Here is a brief explanation in common terms:
Imagine you're given a lock that has never been used, and you create a unique key for it. In Ethereum, creating an account is like crafting this unique key, known as a private key. Now, here's a fascinating aspect of Ethereum: the lock—your account—already exists in the world of Ethereum! It's not that you create a new lock; you just make a key that perfectly fits into one of the countless locks floating in the Ethereum universe.
Here's how it works:
The Universe of Addresses: Ethereum has many possible addresses (like locks waiting to be opened), and they all technically "exist" from the beginning. They're just waiting for someone to claim them by generating the corresponding private key.
Generating Your Key: When you use a wallet like MetaMask, it randomly generates a private key for you. This private key then mathematically determines your public Ethereum address (the lock). But here's the catch: it remains invisible on the blockchain until you do something with that account, like sending or receiving funds (turning the key in the lock).
You can find more info on how this works with MetaMask in this article I wrote: MetaMask under the hood—not just a crypto wallet
The Role of Transactions: Think of the blockchain as a ledger. It only records events that happen, like transactions. Nothing will be recorded if your account hasn't been involved in any transactions.
How Etherscan Comes Into Play: Blockchain explorers like Etherscan are like detectives with a master list of all possible locks and keys. If you give Etherscan a lock (an address), it can acknowledge that this is a valid lock. However, without any transactions, Etherscan won't have any history of that lock because it hasn't been a part of any recorded events.
Gas Fees and Account Creation: Creating an Ethereum account doesn't require gas. Gas comes into play when you want to make a transaction—when you turn the key and interact with the lock, which becomes part of the blockchain's recorded history.
When you create a new Ethereum account, you're not carving out a new space on the blockchain. Instead, you're just claiming one of the myriad pre-existing spaces by creating a key for it. No gas is needed until you decide to make a transaction and leave your mark on the Ethereum history book.
Feel free to reach out any time!