the Ethereum blockchain should contain a list of blocks, with each block containing a bunch of ether transactions including the reward for the miner of that block.
Each block is a well-ordered list of transactions that were accepted by the network. The blocks themselves are well-ordered, so the blockchain is a well-ordered set of transactions. Transactions are allowed or disallowed depending on whether they follow protocol (correct signature, has enough money, acceptable to the receiving contract, etc.)
I also got the impression that the Ethereum blockchain is actually a list of contracts, as each contract has an "address" and being immutable once deployed.
In addition to the from
and to
accounts and amount
, ethereum protocol includes the amount of gas
and the gasPrice
(a sort of priority) and, importantly data
.
A specially crafted transaction sent to address(0
) can contain compiled bytecode
for a smart contract in the data
field. If this transaction is acceptable, then the contract is assigned an address. Such contract addresses are virtually indistinguishable from wallet addresses. These deployment transactions make the "fact" of the deployed contract apparent to all observers.
Contracts have named functions (e.g. deposit, withdraw, transfer) and addresses in the same format as externally owned accounts (wallets). So, one can sign a transaction and address it to a contract instead of to another wallet. The data
field will usually contain additional information such as the function to invoke and arguments to pass in. Contracts have no choice except to process the incoming transactions and messages from other contracts.
A contract is a class (in OOP term) contains a bunch of functions that can be called by anybody once deployed on the blockchain. Each function may or may not contain ether transactions.
Contracts are virtually indistinguishable from wallets but they have code instead of private key holders. They have internal storage space so they are stateful. They have functions that can update the state or report it.
There are patterns that closely resemble OOP but that is largely a matter of style. Deep down they are more like stateful application network protocols. Once deployed they can't be amended and their internal state (which is the obvious result of the code and all the transactions that have been sent to the contract) is immutable.
You will find considerable discussion about upgradeable contract patterns that, I think, obfuscate the facts for newcomers. A contract cannot be changed once released, but the initial release may include intentionally modular and upgradeable design. For example, delegating a process to another contract and some kind of procedure to reassign responsibility from time to time.
The machine-level code is defined at the protocol layer. Developers generally use a higher-level language such as Solidity to write the contracts in human-readable form and then compile the source code into bytecode for the Ethereum Virtual Machine.
Hope it helps.