Runtime Bytecode vs. Bytecode in Solidity Deployments with Remix

Maddy
Coinmonks
Published in
2 min readJun 24, 2024

--

As a Solidity developer, you’re likely familiar with deploying contracts using Remix. However, a nuanced yet critical distinction to grasp is between “bytecode” and “deployed bytecode.” Understanding this difference can help you better manage and troubleshoot your smart contracts.

Bytecode

Bytecode is the compiled version of your Solidity smart contract. After writing and compiling your contract in Remix, you get the bytecode, which includes:

  1. Contract Creation Code: This runs only once at the time of deployment. It includes the constructor and initialization logic.
  2. Runtime Code: This is what gets stored on the blockchain and executed whenever the contract is called.

In Remix, the bytecode is displayed under the “Compilation Details” section as a long string of hexadecimal characters.

Deployed Bytecode

Deployed bytecode is the part of the bytecode that remains on the blockchain after deployment. Essentially, it’s the runtime code stripped of the creation code. This is the code executed when interacting with the deployed contract.

Key Differences

  • Bytecode: Used to deploy the contract, containing both creation and runtime code which also includes initialization (creation). This also exists before and during deployment process.
  • Deployed Bytecode: The actual contract code stored on the blockchain and executed during interactions. This exists after deployment, stored on the blockchain.

--

--

Maddy
Coinmonks
0 Followers

Co-Founder and Chief Engineer @ImagineReplay