Questions tagged [bytecode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

How to have solidity output as minimal assembler-close bytecode as possible?

While as indicated in this answer it is probably impossible to have Solidity optimize away the free memory pointer and it's initialization causing the bytecode to start with 0x6080, I was wondering if ...
Zommuter's user avatar
  • 113
1 vote
1 answer
179 views

What solidity version is used when you give a range to the compiler e.g. pragma solidity >0.7.0 <0.9.0?

I am new to Solidity but have learned you can tell the compiler to use a range of Solidity versions e.g ^0.8.10 || > 0.7.0 < 0.9.0 when deploying smart contracts. My question is how does the ...
davidastro's user avatar
1 vote
1 answer
46 views

Retreiveing Bytecode of another smart contract through a smart contract

I am working on a project and I was wondering if its possible to retrieve the bytecode of another smart contract on Ethereum though my smart contract ? So basically, I will have a copy of that smart ...
Osama Elghazaly's user avatar
0 votes
1 answer
55 views

Determining if a smart contract is using delegatecall

Let's say that I have the bytecode of a smart contract deployed on ethereum (which I got with a call to eth_getCode). How can I programmatically determine if this smart contract uses delegatecall ...
galpo's user avatar
  • 45
2 votes
1 answer
25 views

Should all method hashes be found in a smart contract's opcodes?

I have a compiled/deployed solidity smart contract for which I have encoded all the functions signatures. (4-byte hashes) With the deployed bytecode, I have parsed the pushdata into an array for all '...
jjordan's user avatar
  • 31
0 votes
0 answers
43 views

Obtaining CFGs for individual functions with evm-cfg-builder

I am trying to obtain a Control Flow Graph (CFG) of each individual function in a Solidity contract for Machine Learning analysis purposes. I tried using evm-cfg-builder available at https://github....
PompousPompey's user avatar
1 vote
1 answer
71 views

how to verify a contract on etherscan?

thank you for your answers, but I think I'm still missing something, I don't know where to look for the elements that I don't like? does anyone have a solution please? I try with CONTRACT VERIFICATION ...
Bryce De Nyce's user avatar
4 votes
0 answers
154 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
  • 183
1 vote
1 answer
329 views

How to call a contract function only using function hash in ethers.js?

I would like to call a contract function, but I do not have the contract's abi. Since none of the decoders can decode the function name, the only solution I see is calling the function using its hash. ...
Nal Luksic's user avatar
  • 1,069
3 votes
1 answer
173 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
1 vote
1 answer
27 views

can't find contract after compile successfully in remix: No Contract Compiled Yet

I compile this file in 0.4.8 successfully, pragma solidity 0.4.8; contract A { function f(uint[] arr) constant external returns (uint len) { assembly { pop arr := len }...
LEVI_104's user avatar
0 votes
2 answers
91 views

Decode ByteCode contract

How to decode a ByteCode contract on etherscan for exemple : https://etherscan.io/address/0x6b75d8af000000e20b7a7ddf000ba900b4009a80#code?
adam mr's user avatar
  • 61
2 votes
1 answer
152 views

Trying to use CREATE opcode to deploy a new contract instance using bytecode of a deployed contract

I am trying to get the bytecode from a deployed contract, then by using that bytecode, use the CREATE opcode to deploy a new instance of that contract. Here is the code I'm trying out (but to no avail)...
Allan's user avatar
  • 41
0 votes
0 answers
32 views

How to know if a smart contract is calling a function or if it is an EOA?

Some have suggested detecting the contract bytecode size but this can be spoofed in the constructor where the value will be 0 for an EOA and a contract. Then with create2 and self destruct the problem ...
Nat's user avatar
  • 279
0 votes
0 answers
25 views

How to find contract change by reverse engenering bytecode changes?

A while ago I deployed a smart contract, which has not been verified. Since then I have created a few newer versions, so the original one got lost in commits. My question is using bytecode comparison, ...
Nal Luksic's user avatar
  • 1,069
0 votes
1 answer
82 views

Is there anyway to retrieve tokens sent to a smart contract?

I used my wallet to create a smart contract for a trading bot. Unknowingly , the code for this smart contract was for malicious intent. Once i try to withdraw from the smart contract, my tokens will ...
Jorge's user avatar
  • 1
2 votes
1 answer
77 views

Do immutable variables influence the contract bytecode?

Suppose you have a contract like this: pragma solidity >=0.8.19; contract Bar { uint256 public immutable value; constructor(uint256 value_) { value = value_; } } Will Bar ...
Paul Razvan Berg's user avatar
0 votes
1 answer
188 views

Constructor arguments from EVM bytecode

I have a contract that results to the following bytecode: ...
oyinda david's user avatar
0 votes
0 answers
71 views

Need help understanding 32-bytes difference in contract bytecode

After deploying a contract, I reviewed the comments, rephrased some explanations, added the @author comment on top, then when trying to verify on etherscan, instead of the expected "Nothing to ...
Mouradif's user avatar
  • 277
1 vote
1 answer
121 views

Get bytecode offset(entrypoint) for the function in solidity contract

Suppose, I have the following source code: contract Test { function add(uint a, uint b) public returns(uint) { return a + b; } } And bytecode after compilation: ...
shermike's user avatar
0 votes
0 answers
32 views

where is the bytecode of an unverfied smart contract in etherscan?

Why is the bytecode of the previously unverified smart contract missing from Etherscan? We can view the bytecode of the unverified smart contract before. But now we can't even see the 'contract' tag ...
Fogg lee's user avatar
1 vote
2 answers
35 views

Can't find deployment bytecode for contract created from factory - How to retrieve it?

I have a factory contract that deploys child contracts, to complete a challenge on Ethernauts. I would like to retrieve the deployment bytecode for one of the child contracts, but I'm having trouble ...
Danny B's user avatar
  • 323
0 votes
0 answers
65 views

Unable to use a function from imported library

I'm trying to import and use a library to verify ring signatures. On doing so I'm getting an error while loading smart contract using w3.eth.contract(abi=abi, bytecode=bytecode). ValueError at /sc/...
P S's user avatar
  • 101
1 vote
1 answer
29 views

Can someone explain to me how returns work under the hood in solidity?

Can someone explain how I will be successfully able to return this function reddish(uint256 _red) public view returns (bytes memory) { bytes memory err = abi.encode(msg.sender, _red); assembly ...
Malik Aremu's user avatar
0 votes
1 answer
69 views

Getting execution bytecode from trace_addresses

Given the following call graph: A CALLs B CALLs G CALLs C CALLs G Is it possible to get the full bytecode that was executed by the evm as a single string, given the bytecode of the ...
Biela Diela's user avatar
2 votes
2 answers
1k views

How do i deploy a contract on chain using bytecode

I'd like to deploy a smart contract that can take in bytecode as the argument and deploy that contract. Currently, the only way I see examples of is that they take a specific contract that is already ...
bpop's user avatar
  • 23
1 vote
1 answer
178 views

How to compile with --bin option in solcjs?

I want to compile using --bin option because I want to get to see the bytecode of the compilation. Using solc I know it is something like this: solc --bin How can I achieve this using solcjs?
Falcon Stakepool's user avatar
0 votes
0 answers
48 views

Change an Ethereum Fork's source code to update a specific smart contract code while keeping same address? How to do it (on a fork)

I would like to know how we can update a specific smart contract code on an Ethereum fork or Ethereum Classic fork. The smart contract address should remain the same in order to keep same data storage....
Kevin Wad's user avatar
  • 317
0 votes
1 answer
188 views

Grab last 12 bytes of a bytes32

How do I grab the last 12 bytes of a bytes32 in assembly? For example, the last 12 bytes of bytes32 num = 0xdeb02111e4e5fa8c7c05e983a3446893a36d12ad6d79206163636f756e740000 Thanks!
dNyrM's user avatar
  • 713
2 votes
1 answer
29 views

Initializing Stuct

I would like to know if it is considered good practice initializing a struct when instantiating it or if it is just equally good to initialize its content right after instantiating it. In other words, ...
Alberto Molina's user avatar
0 votes
1 answer
297 views

How to get ABI from a public bytecode of a proxy contract (ERC1967Proxy)?

am trying to write a custom interface for a public smart contract not owned by me. The contract used in official docs of the project is this ERC1967Proxy contract. ABI of that is not really useful and ...
bihinchee's user avatar
2 votes
2 answers
724 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
  • 177
0 votes
1 answer
705 views

Contract verification Failed

I have two contracts Pool and PoolConfiguration, when deploying them to goerli test they both deploy successfully but when verifying on etherscan PoolConfiguration fail to verify and drops this error :...
noro meb's user avatar
  • 328
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
5 votes
3 answers
1k 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,204
4 votes
1 answer
278 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
0 votes
1 answer
71 views

JS Compiler into Solidity

Is there a transpiler that takes JS and spits out Solidity? If yes where, if not why not? I was thinking of creating a library that does this to help write smart contracts in JS if it doesn't already ...
Amu Varma's user avatar
1 vote
0 answers
30 views

Why two different source code generate same control flow graph in ethereum smart contract?

I analyzed control flow graph of two contracts written in solidity with different source code, one having vulnerability and other after resolving it. https://swcregistry.io/docs/SWC-107#modifier-...
Rue Lawliet's user avatar
0 votes
0 answers
93 views

Difference in Control Flow Graph (CFG) of bytecode having vulnerability and after fixing the vulnerability in Ethereum smart contract?

I was analyzing the Control Flow Graph (CFG) extraction from ByteCode by EtherSolve and then thought about an interesting question, how CFG of vulnerable smart contract gets changed after fixing this ...
Rue Lawliet's user avatar
0 votes
1 answer
33 views

What is a0(padded to 32bytes) and 2(padded to 32bytes) in the bytecode?

I was exploring about bytecode and came across a sample transaction mentioned in a Medium article. The issue is that I couldn't understand what do the 2 bytecodes mean in the Input Data bytecode below:...
Junior's user avatar
  • 3
0 votes
1 answer
48 views

Feasibility for Vulnerability Detection in Smart Contracts

I am excited to find out which is more feasible for vulnerability detection in ethereum smart contracts(solidity): Source Code or ByteCode and what's the reason?
Rue Lawliet's user avatar
4 votes
1 answer
2k 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
  • 41
3 votes
1 answer
215 views

Does importing other contracts affects my contract's size?

If I have Contract B{ ... } Contract A{ B b; ... } Does A's contract size equals to B's contract size plus A's other implementation? or does it only increased by the size that b object takes?...
matank001's user avatar
  • 800
1 vote
1 answer
95 views

how can i check hashcode and th amount

I'm new in Solidity, therefore if I have a wrong concept of anything kindly do explain. I'm working for a personal escrow smart contract that should include these functions: 1- function deposit from ...
Yazan Arafat's user avatar
0 votes
1 answer
3k views

Is there a way to get solidity code from bytecode [duplicate]

Recently I had used solidity optimizer. And after reading more about how it works I was interested in trying to go deeper. One of the things I wanted to do was to see how the "solidity" code ...
Sky's user avatar
  • 2,204
1 vote
2 answers
214 views

Could anyone help me with this Solidity Fibonacci challenge please?

What is the shortest runtime bytecode you can write for a contract that satisfies both the following: Accepts calldata of length 32 bytes representing one uint256 (no function selector) Returns, as ...
Vidhan Mangla's user avatar
1 vote
1 answer
30 views

How does Ethereum / the EVM know not to execute metadata/auxdata?

I have a contract as such: // SPDX-License-Identifier: MIT pragma solidity 0.8.15; contract SSimpleStorage { uint256 storedNumber; function storeNumber(uint256 newNumber) external { ...
Patrick Collins's user avatar
1 vote
0 answers
69 views

Why am I not able to access the storage of a contract deployed with bytecode?

I'm learning about EVM and I was trying to write a simple smart contract using bytecode only. What the contract is supposed to do is write the number 202 to storage slot 0 read from the storage and ...
Rodrigo Pina's user avatar
1 vote
0 answers
172 views

Find metadata URL from EVM bytecode

Currently, I am looking for a way to extract the metadata.json file URL from the ethereum bytecode. I have referred to this doc and figured out that metadata mapping is stored CBOR-encoded manner. ...
Sajitha Liyanage's user avatar
0 votes
1 answer
76 views

The Get Functions of ERC1820 (added in genesis file) not working correctly on Quorum

Because I cannot deploy the magic ERC1820 directly to my private Quorum Network, I must add it to the genesis file like this: "0x1820a4b7618bde71dce8cdc73aab6c95905fad24": { "...
Majd TL's user avatar
  • 3,177

1
2 3 4 5