• Smart Contract
  • Ethereum Concepts

Ethereum Concepts

Smart Contracts are the programs that governs the behavior of state in blockchains that are wrapped by state machines.

It is not related to:

  • Machine Learning or Artificial Intelligence (not smart)
  • Legal (don't have legal bounds, not like a real-world contracts)
  • Automatically stuffs (you need to manipulate with a EOA)

We mentioned "state" & "machine", this is what Ethereum differs from Bitcoin, see EVM

A lot of people are confused by the buzzword "Virtual Machine", thinking it's really like a traditional VM using VirtualBox, a sandbox with Operation System running in it.

Actually, the word VM refers to virtualization, it refers to an abstract layer to a physical machine's resources like storage and networks.

The EVM doc should also show you an illustration of VM, its execution layer is volatile and stack-based, versus the register-based one.

And it has a virtual ROM which stores immutable contract codes, and a storage for accounts (smart contract writes to this account storage) and a storage for the world state.

Why it is a "state" machine? Because it produced a deterministic and atomic (all or nothing) output given a input like a mathematical function:

Y(S, T)= S'

Given an old valid state (S) and a new set of valid transactions (T), the Ethereum state transition function Y(S, T) produces a new valid output state S'

eth.build is also a good sandbox for you to know how ethereum works.

ERC

Also, you have to know what is EIP and ERC.

Simply put, they define the standard.

ERC20

An ERC20 token contract keeps track of fungible tokens: any one token is exactly equal to any other token; no tokens have special rights or behavior associated with them. This makes ERC20 tokens useful for things like a medium of exchange currency, voting rights, staking, and more.

from OZ

ERC721

ERC721 is a standard for representing ownership of non-fungible tokens, that is, where each token is unique, such as real estate, voting rights, or collectibles, where some items are valued more than others, due to their usefulness, rarity, etc.

from OZ

Last updated on November 15, 2022