Ethereum Features

In Bitcoin, private keys prove ownership of UTXOs.

When you spend bitcoin, you spend from previous transactions.

And to calculate your current balance, you have to sum up all the UTXOs that you own.

The reason Bitcoin uses UTXOs is that they make it easy to make transactions and prevent double spending.

Think back to the piggy bank analogy from week 1.

In Ethereum, private keys prove ownership of an account, which tracks a current balance.

Accounts are more space efficient than UTXOs, since to calculate your balance, you only have to reference your account, rather than summing across all your UTXOs.

Also, since our ultimate goal is to support smart contracts, it’s much cheaper and easier to look up an account balance and also transfer between accounts when we have an account model rather than a UTXO model.

In Ethereum, there are two types of accounts: externally owned accounts and contract accounts.

Externally owned accounts are, as their name implies, owned by some external entity — outside of the Ethereum network.

This could be a person, group of people, a corporation, or something else.

Externally owned accounts contain an address that they use to let people send them ether, and also a balance of ether.

This type of account can send transactions to transfer ether or to trigger contract code, which lives in contract accounts.

Contract accounts are owned by smart contracts.

They contain an address, associated contract code, and also persistent storage.

Their code is executed when externally owned accounts or other contract accounts make transactions to trigger their code’s function calls.

Smart contracts in Ethereum are like autonomous agents that live inside of the Ethereum network, whereas regular users controlling externally owned accounts are not.

Smart contracts react to the external world when they are poked by transactions, which call specific functions.

Smart contracts have direct control over an internal ether balance, internal contract state, and also permanent storage.

Ethereum smart contracts generally serve four main purposes.

They can be used to store and maintain data.

The data representing something useful to users or other contracts.

For example, there could be a smart contract defining a new token currency, or perhaps a certain organization’s membership, which you have to pay a certain amount to obtain.

Smart contracts can also be used to manage a contract or relationship between untrusting users.

This is perhaps the most easily understood use of smart contracts, as it’s just running a regular contract but on the distributed Ethereum network.

For example, you could have smart contracts that manage financial contracts, escrow, or insurance.

Smart contracts can also provide additional functionality to other contracts.

You can write contracts that call other contracts, perhaps using them as a software library, leveraging the functionality of an existing contract.

And finally, smart contracts can be used for complex authentication use cases.

For example, you can define m of n multisignature, which is also something we looked at when we studied Bitcoin.

Intro: Ethereum Virtual Machine