🔮
Ethereum
  • General
    • What is Ethereum
      • Ethereum & Bitcoin General Comparison
      • Singleton State
      • The Ethereum Virtual Machine (EVM)
      • Opcodes (operation codes) EVM
      • Ethereum Client
      • Forks
      • Gas (wei)
        • EIP-1559
        • Table Conversion (wei)
      • Proof of Stake (PoS)
      • Proof of Authority (PoA)
      • The Beacon Chain
      • Networks
        • Ethereum mainnet
        • Goerli
      • Account-based model & UTXO-based model
      • Externally Owned Account (EOA)
      • Node Clients
        • Geth
        • Nethermind
      • Contract Account
      • Smart Contract Upgradeability
      • Ultrasound Money
      • Merkle Trees
        • Patricia Merkle Tree
      • Tries
        • State Trie
        • Storage Trie
        • Transactions Trie
        • Receipts Trie
      • Transactions
        • Ethereum Transaction Architecture
      • World State
        • Chain of States
        • Chain of Blocks
        • Stack of Transactions / Mempool
      • Contract Creation
      • Message Call Transaction
      • P2P Network
      • Web3.js
      • Ether.js
        • Smart Contract Interaction Example
      • Web3.js vs Ether.js
      • Node Providers
      • ENS (Ethereum Name Service)
      • Web3 dapp
      • Escrow
      • Multi-signature
      • ERC-20 tokens
        • Send ERC20s to Contracts
      • NFTs
        • ERC-721 and ERC-1155
      • Solidity
        • State Variables
        • Data Location
        • Numbers
        • Modifiers
        • View & Pure Modifiers
        • Data Types
          • Modifiers
          • Modifiers (Functions)
          • Address & Address Payable
        • Hardhat
        • Payable Functions
        • Receive Function
        • Fallback Function
        • Global Variables
        • Self Destruct
        • Create2 Function
        • Revert function
        • Require function
        • Assert Function
        • Calldata
        • Interface
        • Mapping
        • Array
        • Struct
        • Inheritance
          • Virtual & Overwrite
          • Multiple inheritance
          • Hierarchical Inheritance
        • Events
          • Indexed (keyword)
          • LOG0 - LOG4
        • Multi-signature Example
        • Smart Contracts
          • Context
      • Application Binary Interface (ABI )
  • Extras
    • Terminology
      • Bytecode
      • Keccak-256
      • Turing complete
Powered by GitBook
On this page
  1. General
  2. What is Ethereum

Message Call Transaction

A message call transaction is a type of transaction in Ethereum that is used to interact with a smart contract or another EOA. It is initiated by an external account (i.e., an Externally Owned Account or EOA) and sends a message to the contract, triggering a function call within the contract.

A message call transaction contains several fields:

  • Nonce: A unique value used to prevent replay attacks.

  • Gas price: The amount of ether (ETH) paid per unit of gas consumed by the transaction.

  • Gas limit: The maximum amount of gas that the transaction is allowed to consume.

  • To: The address of the contract that the message is being sent to.

  • Value: The amount of ether (ETH) being sent with the message.

  • Data: The input data for the function call being triggered in the contract.

When a message call transaction is executed, the EVM (Ethereum Virtual Machine) creates a new execution context, loads the code of the contract specified in the "To" field, and executes the function specified in the "Data" field using the input parameters provided in the same field.

The contract function can modify the state of the contract, emit events, or even call other contracts or external functions using message call transactions. Once the function has completed execution, the state changes made by the function are saved to the blockchain.

If the transaction runs out of gas before it completes, all changes to the state are reverted, and any ether sent with the transaction is refunded to the sender.

                             +----------------------+
                             |   Smart Contract     |
                             |                      |
                             |  Contract Code and   |
                             |    Data Variables    |
                             +----------------------+
                                         |
                                         |    Execution
                                         |    Context
                                         |
                                         v
+----------------------+     +----------------------+     +----------------------+
|   External Account   |     |   External Account   |     |   External Account   |
|                      |     |                      |     |                      |
|   Nonce              |     |   Nonce              |     |   Nonce              |
|   Balance            |     |   Balance            |     |   Balance            |
|   Contract Code      |     |   Contract Code      |     |   Contract Code      |
|   Storage Data       |     |   Storage Data       |     |   Storage Data       |
|                      |     |                      |     |                      |
+----------------------+     +----------------------+     +----------------------+
           |                          |                          |
           |                          |                          |
           |                          |                          |
           |    Message Call          |      Message Call        |
           +------------------------->                          |
                                      +------------------------->

In this representation, there are three external accounts, each with a nonce, balance, contract code, and storage data. The smart contract is represented as a separate entity with its own contract code and data variables. The message call transaction is depicted as an arrow from the external account to the smart contract, passing along the execution context.

During a message call transaction, an external account sends a message to a smart contract, which triggers the execution of the contract code. The message contains input data, which can be used by the smart contract to perform specific actions or modify its state. The smart contract can also return output data as a result of its execution.

The state of the external account and the smart contract can be updated during the execution of the message call transaction, such as changes in the nonce, balance, contract code, or storage data.

PreviousContract CreationNextP2P Network

Last updated 2 years ago