Wallet and User Account in Several Cryptocurrency Systems - Ethereum
We now take a look on Ethereum wallet.
Ethereum Network and Ethereum Wallet
Ethereum is positioned as a smart contract platform, in which the contract code is executed in a decentralized way and therefore cannot be reverted once executed. This is the platform supporting a large amount of tokens nowadays.
The native currency in Ethereum is called ethers and it is used as fuel (gas) when one makes a transaction. A transaction can be a transfer of certain amount of ethers to another account, or an interaction with a deployed contract in Ethereum.
We will first examine the transfer of ethers.
In Ethereum, the balance of an address is a state of that address. If we say an address #1 has 5 ethers, 5 ether is the state of this address #1.
Who can spend or use this balance? Ethereum address follows the same pattern: this address is generated by a specific private key, and who owns this private key can spend the balance (technically, sign a transaction of spending this amount of ethers).
So Ethereum wallet is where the private key is held.
In Ethereum, transaction is initiated from an address, not from a wallet. Remember that in Bitcoin wallet, wallet owner initiates transfer transaction, and the wallet is responsible for consolidating various UTXO (entries of several addresses) in order to spend that amount of bitcoins. In Ethereum, one need to specify which address is to be used. And after spending, the state of this address is updated, and the wallet does not create a new address to hold the balance.
The following is an illustration. Suppose address #1 is to send 0.5 ETH to address #2. After this transaction is successfully mined and included in the ledger, the balance of address #1 becomes 4.5 ETH, and address #2 becomes 3.5 ETH. They are still address #1 and #2, and no new address is generated to hold the balance.
Therefore, the user account is well represented by address in Ethereum world. Address (and more importantly the private key) becomes the portable element, that can be imported to other wallets. The association of wallet — address is quite loose. One can import one’s own address to any Ethereum wallet if needed.
For example, My Ether Wallet and Metamask are common wallets in Ethereum. Here is how to import key file (in JSON) in My Ether Wallet (left) and in Metamask (right).
Can an Ethereum wallet hold more than one address? Absolutely. One can create / import as many as one wishes. However, these addresses are independent to one another. When one initiates transaction, one is still need to specify which address to be used. The wallet does not perform any account consolidation.
Besides native currency ethers, Ethereum as a contract platform is also a home for many tokens. Tokens are implemented in a smart contract deployed on Ethereum. Technically there is no relationship between ethers and tokens.
Ethereum itself does not enforce any token format. However, for good compatibility the ecosystem comes up with some “standard”. Following this standards helps adoption of this token in common wallets and exchanges. The most common “standard” is ERC20.
How is token balance kept in the Ethereum network? As mentioned before, token is implemented in a deployed contract, and the balance is kept inside the token contract on a specific address.
Therefore, given an addiress, most wallet can display both the ether balance and token balance if the token address iscorrectly specified.
Here is an illustration. Suppose a token called KCCOIN has been deployed on Ethereum. Inside the token contract, address #1 has a balance 30.
In this case, when the token contract ID is specified in the wallet, we can see both 4.5 ETH and 30 KCCOIN.
Here is how Metamask shows both ethers and tokens at the same time in my own account.
Security in Ethereum Wallet
Although the ways Ethereum and Bitcoin is working are not the same, they follow the same private key - address pattern, and the security is tied to the private key. One can access the ethers associated to an address as long as one takes hold of the private key linked to that address.
The private key in Ethereum usually comes with a file in JSON format and a passphrase. It contains the encrypted private key and can only be decrypted with the passphrase. This file is ready for being imported to any Ethereum wallets. (The one imported in the Metamask wallet above are from JSON files).
Also, it is a loose relationship between account and wallet. We can easily import the account (through the JSON file) to a wallet. Although we may rely on some backup / restore features on Ethereum wallet, keeping that JSON file and the passphrase is the most critical security measure when using Ethereum.