Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [bytecode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
34 votes
3 answers
11k views

What is the difference between bytecode, init code, deployed bytecode, creation bytecode, and runtime bytecode?

I constantly see different types of bytecode and do not know what each of them are. What are the differences between bytecode, init code, deployed bytecode, creation bytecode, and runtime bytecode?
Shane Fontaine's user avatar
23 votes
1 answer
15k views

How to find solidity code for a contract address

I need to find out the public contract code i.e. solidity code for a contract address. For eample, here it has a tab for contract code but it's in assembly and byte code only, which is not useful. ...
garg10may's user avatar
  • 724
17 votes
1 answer
3k views

What's the difference between solc's bin bytecode versus bin runtime?

Solc says that bin-runtime is the runtime part of the contracts. What exactly is the runtime bytecode part and how does it differ from bin bytecode output?
dbryson's user avatar
  • 6,393
14 votes
2 answers
1k views

Is there a way to detect which compiler version produced a contract binary?

Given the compiled bytecode on the blockchain, is there a way to detect which compiler version is being used in order to verify source matches bytecode without having to bruteforce all available ...
tayvano's user avatar
  • 16k
13 votes
2 answers
7k views

Why do `throw` and `revert()` create different bytecodes?

throw and revert() are both compiling to the revert operation (opcode 0xfd). According to the docs: The throw keyword can also be used as an alternative to revert(). Why is it then that the ...
SCBuergel's user avatar
  • 8,774
13 votes
5 answers
1k views

What is the shortest bytecode that will publish a contract with non-zero bytecode?

Yes, it's golf. So sue me. Rules The response to getCode() should have some characters that aren’t either 0 or x. To test it out, you can use the following with a local testrpc: web3.eth....
maurelian's user avatar
  • 3,211
11 votes
1 answer
3k views

Difference between bytecode and runtime bytecode [duplicate]

In Remix, clicking on "details" for a contract reveals the "bytecode" and "runtime bytecode". What is the difference?
will_durant's user avatar
  • 1,154
9 votes
1 answer
2k views

Why does changing comments in the smart contract change its bytecode?

Why are these 2 smart contracts, which differ only in the comments, result in different bytecode: 1st pragma solidity 0.4.20; contract Test { // test function test() pure public { } } 2nd ...
medvedev1088's user avatar
9 votes
2 answers
2k views

Deploy pre compiled bytecode using truffle migrations deployer api

I want to deploy pre-compiled Smart Contract bytecode using Truffle migrations. Specifically, it is the Uniswap V2 Factory contract. In the Uniswap V2 documentation there is a cliffhanger, where they ...
Darren Jensen's user avatar
9 votes
2 answers
1k views

What is the purpose of extcodecopy?

I am wondering, what is the purpose of the EXTCODECOPY bytecode instruction? I don't see any advantage in copying the code of another contract in memory. I am a little bit confused, because of the ...
Briomkez's user avatar
  • 1,894
8 votes
1 answer
1k views

When did the Ethereum "free memory pointer" change? (6060... -> 6080...)

I have been digging a bit deeper into the Ethereum bytecode with the specific goal to do contract verification from the source code. I noticed, while doing some tests, that the initial bytes of the ...
Shawn Tabrizi's user avatar
8 votes
1 answer
392 views

Could a contract, or parts of a contract, be reverse engineered from bytecode if the ABI was available?

Compilation back to the original source code from just the bytecode is impossible because all variable names, type names and even function names are removed. (source) It's possible to call functions ...
3to's user avatar
  • 401
7 votes
3 answers
8k views

Deploying a smart contract with just bytecode

I have the bytecode of a contract, can I deploy it to a private network without the need of source code? Does bytecode contain the deployers signature or somehow the network id? Here is the bytecode. ...
EralpB's user avatar
  • 531
7 votes
4 answers
1k views

ABI and Bytecode stored inside Contract

I was scrolling around Ethereum StackExchange and I came across with an interesting thought that I have never read or seen anyone talk about. I'm perfectly aware of how contracts work and are ...
João Quintanilha's user avatar
7 votes
3 answers
8k views

Method ID for a Solidity generated getter function

In solidity, the bytecode for functions is taking the web3.sha3 value of a function name and taking the first 4 bytes of the resulting hash in the format of 0x00000000 So if you have a function ...
Dino Anastos's user avatar
7 votes
3 answers
22k views

Error! Unable to generate Contract ByteCode and ABI

Having issues verifying my token contract on etherscan.io. Receiving the following errors: Note: Contract was created during Txn# Result: Does not match the input creation bytecode found at this ...
Dmitry Shalimov's user avatar
6 votes
1 answer
3k views

How is an ABI stored in bytecode?

I'm trying to understand how a simple hex string like 0x25d8dcf2 is enough information to execute a function in a contract. I've read up on the ABI and understand that the hex string is basically just ...
Earlz's user avatar
  • 471
6 votes
2 answers
4k views

Function to execute raw bytecode in EVM

Suppose, I have the following bytecode (0x610101610102016000526001601ff3) that pushes two numbers to the stack, adds them and returns the value. Now I want to write a function in Solidity that will ...
NB18's user avatar
  • 63
6 votes
1 answer
496 views

Where to download GASPER

Where can I find and download GASPER (short for GAS-costly Patterns checkER), the tool mentioned in the paper Under-Optimized Smart Contracts Devour Your Money?
Tom Hale's user avatar
  • 3,107
6 votes
2 answers
5k views

Contract code size (and how to work around it?)

I'm writing some rather substantial Solidity smart-contracts, and believe I'm hitting the EIP170 24k bytecode size limit. I've already (a) factored my code into libraries (b) today split my ...
Chet's user avatar
  • 121
5 votes
3 answers
8k views

Is it possible to get the bytecode of an already deployed contract in Solidity?

Is it possible to get the bytecode of an already deployed contract from another contract? Example: get bytecode of contract A using contract B in Solidity.
alireza vafa's user avatar
5 votes
3 answers
2k views

Where are the smart contract constants stored?

I want to double-check something. I had been writing upgradable smart contact that uses a lot of constants. As far as I can see, smart contracts aren't storing constant variables in their storage. ...
Sky's user avatar
  • 2,312
5 votes
1 answer
6k views

Deploying contract using byteCode

In that example you can see, how to deploy a new contract having just ABI and ByteCode (uses for copy and deploy contracts from mainnet to your testnet for example). /****** Deploying new contract ...
Vladimir's user avatar
  • 181
5 votes
1 answer
5k views

How to get byte code from deployed contract in

I want to get the byte code of a deployed contract. How can I get it? Is there a special function in web3.js? I haven't found any.
Stepan Poperechnyi's user avatar
5 votes
1 answer
244 views

First instructions in bytecode (606060405)

I'm trying to figure out how EVM bytecode works and I created an empty contract in Remix. The assembly version looks like this: PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH1 0xE JUMPI ...
AlexeyKarasev's user avatar
5 votes
1 answer
3k views

Is it possible to get the "creation bytecode" of an already deployed contract in Solidity?

I am looking to get some already deployed code working for myself. With ethers.js I can get the bytecode in the following way ethers.getCode("CONTRACT ADDRESS") However, this is a ...
zen's user avatar
  • 51
5 votes
1 answer
328 views

What kind of bytecode is it in etherscan.io?

I have read some contracts from etherscan.io, and here are something that I don't understand: Why there are some contract addresses that do not have contract source code? Here is an example:https://...
Kindhearted57's user avatar
5 votes
1 answer
1k views

Why would I not want to use intermediate representation (IR) in Solidity v0.8.13 and above?

In Solidity v0.8.13, the intermediate representation (IR) codegen feature has been brought out of the experimental stage. We can now run the compiler with --via-ir flag to enable Yul IR, which makes ...
Paul Razvan Berg's user avatar
5 votes
1 answer
327 views

Is the EVM operand stack size (at any instruction) independent of the execution path?

I'm trying to analyze some EVM bytecode, comparing it with Java bytecode. The Java specification states the following in the JVM specification §4.9.2. Structural Constraints: If an instruction can ...
Floern's user avatar
  • 181
4 votes
1 answer
2k views

Understanding how a simple contract breaks into bytecode

I'm trying to understand how contracts look in terms of bytecode and struggling to do that just based on the yellow paper. In particular, consider the following empty contract: pragma solidity ^0.4....
Peteris's user avatar
  • 1,005
4 votes
1 answer
10k views

How do i get Bytecode of the contract to deploy?

I read this but still cannot figure out how to deploy contract. What i need: deploy smart-contract to Ethereum network via web-based wallet - Myetherwallet, menu Contracts where there are 2 fields; ...
Vic Nicethemer's user avatar
4 votes
1 answer
2k views

web3.eth.getCode doesn't return the data shown on etherscan

For example, let's take contract address 0xdac17f958d2ee523a2206206994597c13d831ec7. Does anybody have an idea why the following two are totally different: The string returned from await web3.eth....
goodvibration's user avatar
4 votes
2 answers
1k views

Run EVM Code outside the Blockchain

is there any way to execute functions on a smart contract (as EVM-Bytecode) in a separate program like evm (provided by go-ethereum) without having to run a test-network? I need to find a way to run ...
letsgetsomecodedone's user avatar
4 votes
3 answers
3k views

How to deploy a bytecode-only contract without an ABI

I see a contract's bytecode on chain that I want to re-deploy almost verbatim, but the issue is that there's no verification -- no ABI or source code. Can I still redeploy this contract to a hardhat ...
John Targaryen's user avatar
4 votes
1 answer
380 views

Where are internal functions in bytecode?

I recently deployed a test contract on Ethereum that more or less just had a bunch of internal functions. On etherscan, decompling the bytecode I did not see these internal functions being listed. So.....
spongyball322's user avatar
4 votes
1 answer
379 views

What does `JUMP [out]` stand for in Remix IDE?

After compiling this contract: pragma solidity ^0.4.25; contract Simplest { constructor() public { } function two_paths(bool _a) public pure returns (uint) { if (_a == true) { ...
Peteris's user avatar
  • 1,005
4 votes
1 answer
633 views

solc producing different contract binary depending on OS

I have a Linux, and another person has a Mac. We have the same solc compiler version, except for the OS extension (I have 0.4.24+commit.e67f0147.Linux.g++, they have 0.4.24+commit.e67f0147.Darwin....
Alex Altair's user avatar
4 votes
3 answers
2k views

Why write an EVM in bytecode, and not in something like Python or Go?

I know that Ethereum runs in virtual byte code and there's a javascript-like wrapper language called Solidity. This question is about why the developers chose this approach? What makes it infeasible ...
nick carraway's user avatar
4 votes
1 answer
611 views

Contract is sent and gets an address, but eth.getCode returns 0x

I'm trying to deploy a contract on a private blockchain network. My solidity code has a lot of variables used in it. The deployment does give me a contract address, however, when trying to retrieve ...
Jacob's user avatar
  • 41
4 votes
2 answers
499 views

Why is the jump address calculation so complex in compiled Solidity code?

I have the following simple Solidity contract: pragma solidity ^0.4.0; contract Test { function Test() { intfunc(5); } uint8 store; function intfunc (uint8 a) internal { ...
Eugene Osovetsky's user avatar
4 votes
0 answers
373 views

Hardhat and foundry, contract bytecode different

I'm developing a contract in hardhat project. But now I want to write test by foundry. My problem is I'm using create2, but when running contract by hardhat and foundry they gave different addresses. ...
CT95's user avatar
  • 406
4 votes
3 answers
1k views

How to deploy contract with bytecode from etherscan?

For example, I want to deploy a contract to my local testnet. But I only have its opcode from etherscan. How to deploy the contract with just those runtime bytecode?
user avatar
4 votes
0 answers
529 views

Is there an app to read QR code of smartcontract bytecode and trigger it?

I want to know if there is a workaround for a smartphone user to simply scan a QR code that would trigger a transaction using a custom smartcontract (not a native currency). The contract would behave ...
Etienne's user avatar
  • 173
3 votes
2 answers
2k views

How to decode the output of an eth_call that returns a Tuple[]

I am developing a low-level library that interacts with RPC nodes directly. There is a requirement to call the AaveV2 getAllReserveTokens function, and I want to decode the output data. The particular ...
pestopasta's user avatar
3 votes
3 answers
410 views

Bytecode: Does it Reveal What Language it Was Programmed In?

Does EVM bytecode have some indication to what high-level language it was programmed in?
Daniel Connelly's user avatar
3 votes
1 answer
276 views

How to read private immutable field?

In solidity, immutable fields are stored on bytecode and not at the storage slot. So, if I want to query how can I do it? eg: pragma solidity >=0.7.0 <0.9.0; contract MyContract { uint ...
Abishek Bashyal's user avatar
3 votes
2 answers
1k views

Difference between `bytecode` and `deployedBytecode` (especially for contracts with constructor args)

Suppose I have a contract like pragma solidity ^0.8.17; contract MyContract { constructor(string arg1, uint arg2) { ... } ... } When I compile the solidity contract (actually ...
ywat's user avatar
  • 217
3 votes
1 answer
1k views

How to verify smart contracts on different solidity versions

I'd like to build my own smart contract verify system with all solidity versions both on single file and multiple files just like what etherscan or other block explorer does. I was able to verify for ...
kimiro's user avatar
  • 165
3 votes
1 answer
1k views

How does a contract's constructor work and load input values?

I set up the following contract: pragma solidity ^0.4.25; contract Simplest { uint x; constructor(bool _lucky) public { if (_lucky == true) { x = 7; } else { ...
Peteris's user avatar
  • 1,005
3 votes
2 answers
1k views

How to construct deployable bytecode from runtime bytecode?

For example I want to redeploy/clone a contract to another address but don't have the original source code, so I only have the runtime bytecode stored on the blockchain. If I try to deploy the runtime ...
hellopeach's user avatar

1
2 3 4 5