Aller au contenu

Ethereum

Uses a JSON-RPC 2.0 API. Testable with trufflesuite/ganache-cli

Architecture

EVM

Data formats

  • most of the int results are encoded in hex
  • addresses are in "SHA3" (keccak-256 hash)

Utilities/Misc

  • web3_clientVersion
  • eth_protocolVersion
  • net_version: get the networkid (1 for Ethereum, 56 for BSC)
  • Filters (provides notifications when a pending transaction arrive, or when a certain block arrives). Filters must be uninstalled manually or timeout after a period of time.
  • Logs (attached to filters only)
  • Direct calls: eth_call can call directly an object
  • Whisper protocol (shh_version etc): a messaging system available for dapps. Can also have filters.

Client/User

  • can mine (hashrate, submit a solution for the PoW)
  • can have a coinbase address
  • can have multiple addresses
  • balance = sum of the balance of every address
  • can compile solidity, LLL or serpent code

Transaction

can be addressed by:

  • block content hash and index inside the block
  • by transaction hash
  • block number and index inside the block

properties / methods

  • signed
  • receipt
  • estimate mode (to get the gas estimation)

Address

  • Has multiple transactions
  • Can contain code (?)

Gas

  • has a price (in wei)

Block

Can be addressed by:

  • height (= absolute number)
  • contents hash

properties/methods:

  • proof of work data (target condition, seed hash etc)
  • contains a variable (?) number transactions
  • note: uncles can be addressed with their own methods

Storage

  • Sync status (start block, current block, highest block)

Scaling / Resource usage

Gas

Gas = transaction fee Each block has a gas limit.

Blocks

  • Parent -> Child graph
  • multiple children can be created but 1 can be accepted in the blockchain

Corollary

  • If we increase the gas limit, we can fit more transaction in a block ==> faster processing time but more used resources.
  • If the blocks are too fast, multiple children will be created and become stale. This is the "uncle blocks" (or orphaned/stale blocks).
  • note: uncle blocks give rewards

All these factors combined gives the Ethereum community a sense of how well the network is handling the load we’re putting on it. If the uncle rate is low and congestion is high, it might be time to consider increasing the gas limit. If the uncle rate is skyrocketing and nodes are falling off the network, the gas limit may be too high, affecting the security of the network.

Ethgasstation.info