Bytecode (also called portable code or p-code[citation needed]) is a form of instruction set designed for efficient execution by a software interpreter.

Bytecode is the compiled code that can be executed by a virtual machine, such as the Ethereum Virtual Machine (EVM). Bytecode is typically generated by compiling source code written in a high-level programming language, such as Solidity, into machine-readable instructions that can be executed by the EVM.


// Solidity code
pragma solidity ^0.8.0;

contract SimpleContract {
  uint256 public value;

  function setValue(uint256 newValue) public {
    value = newValue;

// Bytecode (in hexadecimal)

In this example, we have a simple Solidity contract called "SimpleContract" that includes a public variable called "value" and a function called "setValue" that can be used to update the value of "value".

The Solidity code is compiled into bytecode, which is a hexadecimal string that represents the machine-readable instructions that can be executed by the EVM. The bytecode is much longer and more complex than the original Solidity code, and includes a set of low-level instructions that can be executed by the EVM to update the state of the blockchain and execute the smart contract.

Last updated