Skip to main content
21 votes

How is the address of an Ethereum contract computed?

Thanks to eth's answer, it helped a lot to resolve $2000 issue. Just solved issue with funds, which were sent in main Ethereum network to address of smart contract, deployed to test Ethereum network. ...
k06a's user avatar
  • 3,036
15 votes
Accepted

CREATE opcode: what does it really do?

CREATE, in a way, does a built in CALL. What actually happens is that the data passed to call isn't the contract bytecode, it's the init bytecode. When CREATE opcode is executed, the EVM creates a ...
natewelch_'s user avatar
  • 12.1k
13 votes

Passing constructor arguments to the CREATE assembly instruction in solidity

This worked for CREATE2. Maybe it also works on CREATE? abi.encodePacked(bytecode, abi.encode(arg1, arg2)) Example (CREATE2) pragma solidity ^0.5.11; contract Wallet { address public owner; ...
tsknakamura's user avatar
13 votes

How is the address of an Ethereum contract computed?

Here's a node.js script that deterministically computes an Ethereum contract address given the contract creator's public address and nonce value. Let me know if anyone has questions about inputs, etc. ...
kawthuldrok's user avatar
6 votes

How is the address of an Ethereum contract computed?

Here is updated Python version for modern Ethereum libraries (eth-utils): import rlp from eth_utils import keccak, to_checksum_address, to_bytes def mk_contract_address(sender: str, nonce: int) -> ...
Mikko Ohtamaa's user avatar
4 votes
Accepted

EXTCODESIZE returning 32 for contract size less than 32

It is returning 32 because your deployement bytecode explicitely return 32 bytes. Breaking it down : \x60\x0a\x60\x0c\x60\x00\x39\x60\x20\x60\x00\xf3 PUSH 0x0a : length to copy (runtime bytecode is ...
hroussille's user avatar
  • 7,751
4 votes

How is the address of an Ethereum contract computed?

RLP done in solidity (did not test this though, beware! just for understanding): function addressFrom(address _origin, uint _nonce) public pure returns (address) { if(_nonce == 0x00) ...
Alex's user avatar
  • 283
4 votes

Passing constructor arguments to the CREATE assembly instruction in solidity

You need to abi-encode the input arguments, and then append the result at the end of the bytecode before passing it to the create function. Suppose you have input arguments arg1, arg2 and arg3. I ...
goodvibration's user avatar
3 votes
Accepted

What is the correlation between "Hash" (Method ID) & "Name"

This is not a Method ID (not a hash of a function name that'd be in the deployed contract) even though Etherscan shows it as Method in the UI. And that it shows as rugPullAll and even other ones if ...
Ake's user avatar
  • 1,149
3 votes

How Can I Identify the Blockchain Where a Smart Contract Is Deployed Using Its Address?

If the question is, can I determine which single chain a contract is deployed on by using its address? The answer is you can't because it isn't unique. There isn't a 1-1 mapping of contract address -&...
Maka's user avatar
  • 1,220
3 votes
Accepted

Do dune analytics `creation_traces` data include contracts created by other contracts?

Yes, it seems that creation_traces includes all contract creations from EOAs as well as from contracts. Every entry in creation_traces has a corresponding entry in traces table. In this query, if ...
ceseshi's user avatar
  • 740
3 votes
Accepted

How difficult is it to deploy a contract to one specific address that you want?

Let me see if I understand your need... So, you would like to know how hard it would be for anybody (other than the contract owner) to deploy a contract in another EVM-compatible chain with the same ...
Jeremy Then's user avatar
  • 4,619
2 votes
Accepted

Is there any difference between the "new Contract()" syntax and the assembly "create" opcode?

The only meaningful difference is that the first version checks that the deployment was successful. The address returned from create can indeed be address(0), and in this case it means that the ...
0xSanson's user avatar
  • 3,294
2 votes

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

Update : I was able to work through this problem. Unfortunately there is no way to get the creation bytecode from a deployed address. You can get it from type(ContractName).creationCode, but that ...
Allan's user avatar
  • 41
2 votes

Storing immutable state in contract data

This is a wonderful question! The problem you're running into is that in Ethereum the code that you provide to CREATE is executed. We call this code "init code" and it's expected to return ...
K. Fichter's user avatar
1 vote
Accepted

Redeploy to same address using CREATE (not CREATE2) | aka does a nonce reset?

Can you overwrite or override an existing contract? It's impossible to overwrite an existing contract in Ethereum. From EIP-684: If a contract creation is attempted, due to either a creation ...
eth's user avatar
  • 86k
1 vote

I can´t create a new folder

It is difficult to understand your problem but as i understand your question if you are not able to create folder on remix this is how you can create folder on remix At the end file you can create ...
Ilyas Khan's user avatar
1 vote

Passing constructor arguments to the CREATE assembly instruction in solidity

You have to encode arguments with abi.encode and bytes with abi.encodePacked. Compiles with Solidity 0.4.0. contract DeployContract { function deploy(bytes _bytecode) external returns(address ...
Igor Yalovoy's user avatar
1 vote
Accepted

Why do I not see CREATE or CREATE2 opcodes in traces of contract creating transactions?

Why do I not see CREATE or CREATE2 opcodes in traces of contract creating transactions? because this contract is NOT created using CREATE or CREATE2 opcode, it is created by sending nil in the 'To' ...
Nulik's user avatar
  • 4,061
1 vote

Is it possible to get the revert reason during CREATE?

Well, it ain't pretty, but... for testing purposes I decided to encode the revert message in the returned bytecode during contract deployment. I made it clear by returning the STOP opcode 00 followed ...
phaze's user avatar
  • 1,615
1 vote

Does the max code size limitation apply to init code, too?

It seems the answer is No. This makes sense a priori in that the DOS attack this code size limitation was designed to thwart was about loading huge chunks of bytecode from the database at very low ...
Olivier Bégassat's user avatar
1 vote

Does the max code size limitation apply to init code, too?

Yes. Typically the factory contract contains the code to deploy. The size of the factory includes that. Hope it helps.
Rob Hitchens's user avatar
  • 55.4k
1 vote

Why command `npm hardhat` doesn't create a new sample project?

You must to run $ npx hardhat --verbose you will get the location of a hardhat config file like this: $ hardhat:core:config Loading Hardhat config from /home/lyon/hardhat.config.js +0ms delete it ...
Ted's user avatar
  • 11
1 vote

ParserError: Expected token Semicolon

I got this to compile with solidity 0.4.18; pragma solidity ^0.4.17; import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-solidity/v1.6.0/contracts/token/ERC20/StandardToken.sol"; ...
Rob Hitchens's user avatar
  • 55.4k
1 vote

How is the address of an Ethereum contract computed?

The contract address is typically a hash of the sender's address and sender's wallet nonce. The actual contract code doesn't make any difference - the hash is the same regardless of the code. Above I ...
Lauri Peltonen's user avatar
1 vote

How is the address of an Ethereum contract computed?

Here is a pure ethers.js implementation in TypeScript, returning a checksummed address. nonce is expected to be a regular number. (ethers.js does have a function called getContractAddress too, but it ...
riordant's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible