while ethereum has its own native cryptocurrency (ether) that follows almost exactly the same intuitive rules (as bitcoin), it also enables a much more powerful function: smart contracts.
for this more complex feature, a more sophisticated analogy is required. instead of a distributed ledger, ethereum is a distributed the Ethereum Virtual Machine = EVM
in the Ethereum universe, there is a single, canonical computer whose state everyone on the Ethereum network agrees on. ethereum's state is a large data structure which holds not only all accounts and balances, but a machine state, which can change from block to block according to a pre-defined set of rules, and which can execute arbitrary machine code.
the specific rules of changing state from block to block are defined by the EVM. code execution changes the state of the EVM. ether (ETH)
the native cryptocurrency of Ethereum. the purpose of ether is to allow for a market for computation. the amount of ether paid corresponds to the time required to do the computation. these bounties also prevent malicious participants from intentionally clogging the network by requesting the execution of infinite computation or other resource-intensive scripts,
as these participants must pay for computation time.
nodes
real-life machines storing the EVM state. nodes communicate with each other to propagate information about the EVM state and new state changes. accounts
accounts and account balances are stored in a big table in the EVM smart contracts
with smart contracts, developers can build and deploy arbitrarily complex user-facing apps and services such as: marketplaces, financial instruments, games, etc.
in practice, participants don't write new code every time they want to request a computation on the EVM. application developers upload programs (reusable snippets of code) into EVM state, and users make requests to execute these code snippets with varying parameters. programs uploaded to and executed by the network = smart contracts a script that, when called with certain parameters, performs some actions or computation if certain conditions are satisfied.
any developer can create a smart contract and make it public to the network, using the blockchain as its data layer, for a fee paid to the network.
any user can then call the smart contract to execute its code, again for a fee paid to the network.
transaction request
request for code execution on the EVM transaction
fulfilled transaction request and the associated change in the EVM state. cryptographically signed instructions from accounts a submitted transaction includes the following information interacted with (to): contract # txn type = tipo de transação receiving address (if an externally-owned account, the transaction will transfer value.
if a contract account, the transaction will execute the contract code)
identifier of the sender.
this is generated when the sender's private key signs the transaction and confirms the sender has authorized this transaction
amount of ETH to transfer from sender to recipient (in WEI, a denomination of ETH)
optional field to include arbitrary data
maximum amount of gas units that can be consumed by the transaction.
units of gas represent computational steps
maximum amount of gas to be included as a tip to the miner
maximum amount of gas willing to be paid for the transaction (inclusive ofbaseFeePerGasandmaxPriorityFeePerGas)
the data field
the vast majority of transactions access a contract from an externally-owned account most contracts are written in Solidity and interpret their data field in accordance with the the 1st 4 bytes specify which function to call, using the hash of the function's name and arguments the rest of the calldata is the arguments, . types of transactions
those which result in message calls and those which result in contract creation. contract creation results in the creation of a new contract account containing compiled smart contract bytecode. whenever another account makes a message call to that contract, it executes its bytecode. regular transactions: a transaction from one wallet to another. contract deployment transactions: a transaction without a 'to' address, where the data field is used for the contract code. execution of a contract: a transaction that interacts with a deployed smart contract. in this case, 'to' address is the smart contract address.
gas
transactions cost gas to execute. simple transfer transactions require 21000 units of gas. gas is required for any smart contract interaction too. gas prices are denoted in gwei (giga-wei = 1,000,000,000 wei) 1 gwei = 0.000000001 ETH (10-9 ETH) named after , creator of it is the smallest unit of ETH implemented on August 5th, 2021, to make transacting on Ethereum more predictable for users by overhauling Ethereum's transaction-fee-mechanism.
high-level benefits introduced by this change better transaction fee estimation quicker transaction inclusion offsetting ETH issuance by burning a % of transaction fees EIP = Ethereum Improvement Proposals ethereum antes do EIP-1559 taxas de transação calculadas usando mecanismo de leilão transações priorizadas eram aquelas que tinham lances mais altos base fee = quantidade mínima de gas necessária para adicionar transação em um bloco. valor definido e ajustado pelo protocolo conforme demanda só pode ser paga na cripto nativa taxa não vai para mineradores, ela é queimada elimina qualquer incentivo econômico para que mineradores congestionem a rede para lucrar beneficia quem possue Ether, já que dessa maneira há uma redução na quantidade em circulação max fee = valor mais alto que usuário está disposto a pagar pela transação Max Fee > Base Fee + Priority Fee tamanho de bloco flexível estimativas mais precisas de taxas corretoras centralizadas
muito utilizadas no mundo cripto para a compra de criptomoedas a partir de moeda fiduciária (real, dólar, etc.) também oferecem troca de tokens listados principais corretoras brasileiras corretoras estrangeiras mais famosas que funcionam no Brasil