Questions tagged [contract-deployment]

The act of pushing a compiled smart contract in byte code to the Ethereum blockchain.

Filter by
Sorted by
Tagged with
133 votes
7 answers
70k views

How is the address of an Ethereum contract computed?

How is the address of an Ethereum contract computed? What use cases are there for knowing a contract's address in advance?
eth's user avatar
  • 85k
64 votes
7 answers
16k views

How can I verify that a contract on the blockchain matches the source code?

Given the (Solidity) source code of a smart contract, is there a way to deterministically compile the code and compare it with the code on the blockchain? I want to verify that the contract does what ...
J-B's user avatar
  • 8,911
63 votes
13 answers
58k views

Hardhat - How to interact with a deployed contract?

I can deploy a contract using ethers and Hardhat with the following: const myContract = await hre.ethers.getContractFactory("SomeContract"); const deployedContract = await myContract.deploy()...
JohnWLIV's user avatar
  • 733
46 votes
3 answers
22k views

How to write an optimized (gas-cost) smart contract?

As we all know, there are many factors that determine a good smart contract, such as: Security: it has minimal/zero vulnerability so they cannot be exploited by an adversary. Immune to Attacks. Cost:...
Aydin's user avatar
  • 2,107
41 votes
2 answers
9k views

Do contracts also have a nonce?

Do contracts also have a nonce and if so how is it calculated? Usual accounts have a nonce that is increased with every transaction. However, contracts can't make transactions, they can only make ...
mKoeppelmann's user avatar
  • 7,586
35 votes
1 answer
33k views

How to update a deployed smart contract? [duplicate]

I've started developing smart contracts with Truffle and when I edit a contract I always redeploy it by adding another migration script. There are two things that I wonder about: Is this the way it ...
kramer65's user avatar
  • 655
30 votes
4 answers
32k views

Calling function from deployed contract

I want to know how to instantiate an existing contract deployed on the blockchain using its address. e.g: contract A { function f1() {} } A is deployed on the blockchain, and in contract B I ...
Sig Touri's user avatar
  • 1,080
29 votes
5 answers
22k views

What is the real price of deploying a contract on the Mainnet?

I'm trying to deploy a contract on the mainnet, but I've been getting some issues deploying with Truffle. ➜ ballot git:(master) ✗ truffle migrate --network mainnet --dry-run Using network 'mainnet' (...
V. Kartoplya's user avatar
28 votes
7 answers
20k views

Truffle deployment on test network says: Error: exceeds block gas limit

I'm trying to deploy a sample contract (following this guide) but I'm receiving an error of not enough gas. I changed the numbers a little but could not fix it. I saw this question in stack exchange ...
Bush's user avatar
  • 455
28 votes
6 answers
15k views

having a problem with solc-x version "solc 0.6.0 has not been installed"

I m trying to print out the variable (compiled_sol) as you will see in the code below of the python file named deploy.py so I can deploy my smart contract, but I keep running at this error *****INFO: ...
Houssam DERFOUFI's user avatar
24 votes
7 answers
34k views

Encoding/Decoding contract ABI data

How to encode and decode ABI data? Can someone show me an example with web3js library?
gkucmierz's user avatar
  • 773
23 votes
2 answers
11k views

How to get Source code of an already deployed contract?

How can I retrieve the solidity code of an already published contract in the mist wallet?
tokyomonogatari's user avatar
23 votes
1 answer
14k views

At which point the smart contracts get executed?

Let's say I sent a transaction to invoke a smart contract (to its address). At which point will the smart contract get executed? Is it during the transaction validation process? Also, is there any ...
Prabath Siriwardena's user avatar
21 votes
6 answers
33k views

How to find contract's address?

I successfully setup a private blockchain and created the "hello world" contract according to tutorial from etherium web site. One thing that I can't figure out is how to find the contract later. I ...
user3280964's user avatar
20 votes
2 answers
7k views

Deploying the Greeter contract via the geth CLI is not registering in my private blockchain

I am running a local private Ethereum blockchain using: geth --networkid 60098 --genesis CustomGenesis.json --nodiscover --maxpeers 0 --rpc --rpccorsdomain "http://localhost:3000" --datadir "./data" ...
Bill LaPrise's user avatar
19 votes
2 answers
11k views

How to pass constructor parameters to a contract using Truffle?

I am using testrpc and truffle for deploying contracts.I want to pass constructor parameters while deploying. contract User { string public userName; function User(string ...
Crissi Mariam Robert's user avatar
17 votes
1 answer
18k views

truffle migrate: How to deploy a contract whose constructor takes a parameter

I'm using Truffle Version 4 to develop a simple smart contract and am stuck on something I think reflects a very basic misunderstanding that I just can't get my head around. Here's my simple contract,...
Dave Sag's user avatar
  • 879
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,363
17 votes
2 answers
14k views

Canceling / overwriting a pending transaction using geth JSON RPC

This is a private network A transaction was sent to create a contract using the eth_sendTransaction RPC call. The transaction is "removed" marked "will be removed" because it ran out of gas but ...
Bruno Grieder's user avatar
15 votes
2 answers
2k views

When a smart contract is deployed, is its source code publicly viewable?

When a smart contract is deployed to the blockchain, is the source code then publicly viewable to all participants? For example, what you see here in Etherchain. I am aware that there are some ...
jsquaredlau's user avatar
15 votes
2 answers
24k views

How to deploy contract with ether.js

I am trying to figure out the best way to deploy a contract using ethers.js with web3 I can just do: const contractInstance = new this.web3.eth.Contract(contractObject.abi) var deployTx ...
Lucas Rodriguez Benitez's user avatar
15 votes
1 answer
6k views

How to choose an account to deploy a contract in truffle

How do you select an account to deploy a contract using: 1)Metamask 2)Parity 3)some config file
rstormsf's user avatar
  • 4,327
15 votes
1 answer
5k views

Deploying contract with constructor arguments via Geth RPC

How can I deploy a compiled contract with constructor arguments using geth rpc? I have tested my call deployed the compiled contract bytecode just fine, I just don't understand how I can pass ...
Samuel Barnes's user avatar
15 votes
2 answers
6k views

Truffle Migrations Account Locked Error with --network command

I have started a private blockchain using the command, geth --networkid 1337 --datadir ~/home/xyz/testnet --ipcpath /home/xyz/.ethereum/geth.ipc --rpc --rpcapi eth,web3 --rpcport 8545 --rpcaddr ...
godimedia's user avatar
  • 253
15 votes
1 answer
4k views

Bytecode on block chain different from the one used when deploying

When I deploy a contract from node.js using the web3 JavaScript API (connected to a locally running geth), and then check the deployed bytecode using eth.getCode(address) (either from the JS console ...
mazi's user avatar
  • 433
14 votes
5 answers
6k views

How to Compile and Deploy a Smart Contract without running a full node?

I'm new to solidity and smart contract programming. I have already made and deploy smart contracts successfully, but always using Mist. Now I'm not able to do so, because I can't complete a node ...
Moisés Briseño Estrello's user avatar
14 votes
5 answers
3k views

Error: The contract code couldn't be stored, please check your gas amount

I am using the below code to create the contact it give the error: Error: The contract code couldn't be stored, please check your gas amount. Code: primaryAccount = web3.eth.accounts[0]; //...
Veera Sarma's user avatar
14 votes
1 answer
2k views

Given a contract address, can I determine when the contract was deployed?

Ideally the solution would use web3, but other solutions are acceptable. Motivation: Event lookups can be passed fromBlock field. If I know the block a contract was created, I can more accurately do ...
Akhil F's user avatar
  • 1,898
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
  • 15.9k
13 votes
9 answers
33k views

Is there a way to extract ABI from a deployed contract?

I am building a web UI for testing smart contracts and currently I have to supply the ABI for a contract I test. Is there a way to extract the ABI from a deployed contract (preferably programmatically)...
Andrey's user avatar
  • 1,117
13 votes
1 answer
4k views

How to generate a vanity address for a smart contract to be deployed on?

I am aware of the possibility to generate vanity addresses for normal accounts. However, how is possible to generate vanity addresses for external owned accounts (which host smart contracts)? I'm ...
q9f's user avatar
  • 32.8k
13 votes
3 answers
3k views

Is it possible to preload contracts in the genesis block?

Here's the setup I'm trying to use: A genesis.json with the alloc field set to include code. "alloc": { "0000000000000000000000000000000000000001": { "code": "...
Jeffrey B. Petersen's user avatar
13 votes
1 answer
2k views

Is it possible and sensible to deploy a contract to the same address on Mainnet and Ropsten?

Traditionally when people have deployed contracts for public use they have tended to publish separate contract addresses for Testnet and Mainnet. Often this then requires them to include code to check ...
Edmund Edgar's user avatar
  • 16.8k
13 votes
1 answer
3k views

Out of gas during contract creation

A few days ago, several attempts at creating a contract failed with out of gas errors (confirmed by etherscan/ethercamp and getBalance API), however it is not clear to me what failed exactly, and how ...
fair glu's user avatar
  • 365
13 votes
4 answers
3k views

Deploying a contract from a multisig wallet

I created a multisig wallet using Mist, but don't know how to deploy a contract from the wallet address. Is it even possible? If so, how to do this?
user4866's user avatar
  • 131
12 votes
4 answers
10k views

How to deploy smart contract in predefined contract address in private ethereum network?

Is there any method to deploy our smart contract in a particular address (ie. predefined contract address) in private ethereum network? Yes, I have built my own private blockchain based on Ethereum ...
Karthikeyan Thangavel's user avatar
12 votes
1 answer
6k views

How to write my first Solidity "Hello World" smart contract?

I have never written a smart contract before because there is a lot attached to it getting it working. But I finally want to learn it now. I want to write a simple mininmal working smart contract ...
q9f's user avatar
  • 32.8k
12 votes
3 answers
24k views

How to get the contract ABI in new Remix IDE?

Waked up today just to find out the remix browser interface changed to this what happened !!? I cannot find the contract details to get the json interface anymore.
Jose Victor's user avatar
11 votes
1 answer
4k views

How to edit a contract that has already been deployed? [duplicate]

I have been writing my first few contracts. So, as I understand it, once you write, compile, and deploy your contract, the only way to then interact with that contract is via something like web3.js ...
Taylor Pechacek's user avatar
11 votes
2 answers
7k views

How big could a contract be?

I am trying to figure out how big could a contract be? Is it possible to have 10k functions? One million? More? Is there any restriction on the function's body size? Does a bigger contract need ...
StanislavL's user avatar
11 votes
2 answers
12k views

How do I set a gasPrice with ethers deploy script?

I'd like to set a gasPrice in my deploy script, so I could deploy and let miners pick up my transaction when gas is low. Like deploy my contract over night while I'm sleeping to save money. How can I ...
caker's user avatar
  • 185
11 votes
1 answer
4k views

Hardhat: Error: unresolved libraries, but why?

I'm attempting to deploy a contract using Hardhat (via scaffold-eth), but am getting the following error: Error: Factory contains unresolved libraries. You must deploy and link the following libraries ...
The Renaissance's user avatar
10 votes
2 answers
2k views

Programmatically saving the contract address of a submitted contract

I understand how the below web3js code block works, adapted from here: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcontract But how does one save the contract address ...
NYCeyes's user avatar
  • 235
10 votes
5 answers
12k views

Find the creator of a contract

I want to prove that a contract was deployed by a specific address (a factory contract). I have noticed that block explorers such as https://etherscan.io/ list the contract creator. How do they get ...
Joe's user avatar
  • 1,173
10 votes
4 answers
7k views

Passing constructor arguments while deploying contract from byte code

I am trying to deploy a contract via MyEtherWallet from byte code generated by browser-solidity. I unlocked my wallet using private key,but I didn't find any way of passing parameters to contract's ...
Prashant Prabhakar Singh's user avatar
10 votes
2 answers
872 views

How to get a contract verified on etherscan?

I'm having a hard time getting a contract verified on Etherscan. I deployed the contract using Ethereum Wallet, I can effectively find it on Etherscan but when I copy-paste the exact same code to the ...
Donavan Theodor's user avatar
10 votes
4 answers
920 views

Unable to make greeter contract

For the past 7 days I've been trying to make the greeter contract, I've been through 4 different physical computers in 2 different locations and have tried multiple different ways on 3 different ...
冬賀雪花's user avatar
10 votes
4 answers
2k views

Adding Wallet using web3.eth.accounts.wallet.add

On web3 0.20.1, I am using Infura to deploy a contract to Rinkeby. This probably requires me to add a wallet to web3.accounts to provide the gas needed. When I ran the following nodejs code, Web3 = ...
Nyxynyx's user avatar
  • 1,167
9 votes
3 answers
7k views

Who pays gas for smart contracts?

I'm currently writing my first smart contract and I'm trying to figure out how to inject gas into the contract, of course, if it's possible. I'm not sure If I got it correctly. With every transaction ...
Maarduk's user avatar
  • 375
9 votes
1 answer
4k views

Return Token Contract address on truffle deploy

I am trying to figure out how to return the address of a contract when I deploy it with truffle's deployer.deploy. So the goal is that when I deploy a contract that is a custom token, I want to ...
Shawn's user avatar
  • 243

1
2 3 4 5
34