Questions tagged [bytecode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
19
votes
1answer
11k 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. ...
15
votes
1answer
4k views

What is the difference between bytecode, init code, deployed bytedcode, 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 bytedcode, creation bytecode, and runtime bytecode?
13
votes
1answer
2k 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?
13
votes
1answer
713 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 ...
12
votes
3answers
6k 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 ...
10
votes
1answer
2k 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?
10
votes
4answers
569 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....
9
votes
1answer
1k 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 ...
8
votes
2answers
1k 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 ...
8
votes
1answer
525 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 ...
8
votes
1answer
319 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 ...
7
votes
4answers
891 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 ...
6
votes
1answer
2k 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 ...
6
votes
1answer
434 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?
5
votes
3answers
6k 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. ...
5
votes
2answers
357 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 ...
5
votes
1answer
164 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 ...
5
votes
2answers
3k 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 ...
5
votes
3answers
4k 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 ...
5
votes
1answer
283 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 ...
5
votes
3answers
14k 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 ...
4
votes
1answer
1k 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....
4
votes
1answer
8k 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; ...
4
votes
2answers
963 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 ...
4
votes
2answers
1k 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 ...
4
votes
1answer
82 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://...
4
votes
1answer
157 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) { ...
4
votes
1answer
2k 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.
4
votes
3answers
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 ...
4
votes
2answers
436 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 { ...
4
votes
0answers
498 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 ...
3
votes
2answers
361 views

Where is the contract bytecode stored when a contract creates a contract?

When a contract creates a contract, where's the new contract's bytecode stored? For example: This Maker contract was created by their deployment contract: https://etherscan.io/address/...
3
votes
1answer
161 views

Cannot verify Contract - bytecode has small difference

I forgot to verify the ERC20 token contract after deploying it. Now after 5 months, Im doing it again and completely forget which compiler and if I accidently change anything on the code. After ...
3
votes
1answer
565 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 ...
3
votes
1answer
672 views

Why doesn't bytecode match the opcodes on Etherscan?

I'm just going through the first few opcodes on this contract: https://etherscan.io/address/0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e#code. Which are (according to the opcodes view): PUSH1 0x60 ...
3
votes
2answers
4k views

Ethereum Virtual Machine code

Does anyone have an example of what EVM bytecode looks like? New to ETH and trying to understand what exactly gets executed by the virtual machine. Is it similar to how JVM bytecode gets executed from ...
3
votes
1answer
441 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 ...
3
votes
1answer
164 views

What is the purpose of DUP1 at the beginning of contact creation bytecode?

I am trying to analyse the bytecode of creating a contract and I can't figure out why there is a need for the 006 DUP1 opcode in the snippet below. 000 PUSH1 80 002 PUSH1 40 004 MSTORE 005 CALLVALUE ...
3
votes
0answers
74 views

Why is it required to know the function selector in a smart contract to call the function? [duplicate]

I understand what a function selector is and how it is computed: The first four bytes of the call data for a function call specifies the function to be called. It is the first (left, high-order ...
3
votes
1answer
657 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?
3
votes
0answers
139 views

Is there any reference on writing contracts directly with the bytecode language?

It would be great to have a complete reference of all the opcodes available, their exact effects and costs, and an example "Hello World" in ethereum assembly. Edit: this question isn't a duplicate of ...
2
votes
2answers
126 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 ...
2
votes
1answer
791 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....
2
votes
1answer
135 views

Map Bytecode of Function to Function Within Entire Bytecode

Is it possible to distinguish a functions bytecode out of an entire contracts bytecode? For example, when I pull the bytecode from a contract address, I get something like: ...
2
votes
3answers
2k 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.
2
votes
1answer
190 views

How to pass constructor parameters to solc?

I'm trying to compile a Smart Contract to bytecode using solc. I'm on a Ubuntu VM so I have to rely on a simple-to-install cmd line application. Compilation works fine but it seems like I can't pass ...
2
votes
1answer
587 views

Transfer function gas limit, why 2,300?

I read in the literature that the limit for a Solidity transfer function is 2,300 gas units, because it prevents possible threats like reentrancy, etc. However, I cannot understand why exactly 2,300 ...
2
votes
1answer
561 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 { ...
2
votes
1answer
110 views

Bytecode execution during contract deployment

during the process of contract deployment the 'loading' code is executed (60606040523415600e57600080fd5b5b603680601c6000396000f300). This bytecode sequence loads the actual contract into the evm/...
2
votes
1answer
3k views

how to decompile smart contract bytecode?

I don't want the whole bytecode to solidity. I just want that bytecode have fallback function and it's content. is feature in the bytecode about fallback function? about external contract call, ...