50
votes
What is the real price of deploying a contract on the Mainnet?
The cost of your deployment is based on 5 things, with a 6th affecting the estimated cost of deployment:
The flat fee of 32k gas. The CREATE op code, which is called during contract creation, costs a ...
24
votes
Accepted
Truffle migrate vs Truffle deploy
truffle deploy is an alias for truffle migrate. They both do the same thing.
14
votes
Accepted
how is it different .deployed() and .new() ??
You are right.
Truffle test's deployed and new are from truffle-contract. If you look at the doc:
deployed(): Create an instance of MyContract that represents the
default address managed by ...
13
votes
Accepted
Truffle Deployment Error: Invalid number of parameters for "undefined". Got 1 expected 0!
You are passing 1 argument in an attempt to deploy an instance of contract KJToken:
deployer.deploy(KJToken, KJToken.address)
But the constructor of this contract takes 0 arguments:
constructor() ...
10
votes
Accepted
How Can I Get the Gas Cost of Contract Creation *within* Truffle (Migrations/Test)
This is based off what I learned here: https://ethereum.stackexchange.com/a/43004/27157
it("Should deploy with less than 4.7 mil gas", async () => {
let someInstance = await SomeContract.new();
...
10
votes
Accepted
How to estimate my contract code size? it is too big to deploy now
How to estimate gas for deploying a smart contract
I'm using the Yellow Paper, Appendix G, page 25 as reference.
The cost of gas to deploy your contract can be calculated like this:
21000 because all ...
9
votes
Prevent 'truffle test' from invoking 'truffle deploy (migrate)'
I ran into this issue as well, and it is indeed the intended behavior of truffle test: cleanroom behavior. Each run of truffle test redeploys the contracts. If it didn't, then saved state from a prior ...
8
votes
Truffle Flattener creates empty flat file
Try to use output parameter:
truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol
8
votes
Accepted
Truffle v5 runs out of gas but Truffle v4 deploys the contract
Check @goodvibration answer. It should work in most instances.
I don't recommend the answer that I will share below, it will ignore the EIP-170, hopefully there is a better answer
I was only able to ...
7
votes
Accepted
Unhandled promise rejection(gas limit) when deploying Contract to rinkeby using truffle-hdwallet-provider
I added '0x' + in front of the bytecode in the .deploy to make it Work.
.deploy({ data: '0x' + bytecode, arguments: ['Hi there!'] })
If there's no '0x' the bytecode will convert the whole string to ...
7
votes
What is the real price of deploying a contract on the Mainnet?
If your contract costs that much, then you must be doing a bunch of storage initialization. Storage, by far, costs the most to read/write.
The irony of Solidity is that it costs less to redo things in ...
7
votes
Accepted
Error: HelloWorld has not been deployed to detected network (network/artifact mismatch)
in your HelloWorld migration file from migrate folder you should open it and by the tutorial add this:
var HelloWorld = artifacts.require('HelloWorld');
module.exports = function(deployer) {
// ...
6
votes
What is the real price of deploying a contract on the Mainnet?
You should test your deployment process on private network or test network throughly before trying mainnet. I am testing mine on Rinkeby because in Ropsten block gas limit is too low.
In my ...
6
votes
Prevent 'truffle test' from invoking 'truffle deploy (migrate)'
It is really embarrassing, how narrow minded the truffle authors think. My tests run their own deployment that is used in the tests. In my case, the truffle migration includes the steps that data is ...
6
votes
Accepted
Unable to connect to polygon mumbai test network using truffle
After updating the RPC endpoint to https://rpc-mumbai.maticvigil.com from https://rpc-mumbai.matic.today in truffle-config.js it started working fine. It seems that Polygon team updated the RPC ...
6
votes
Accepted
Best security practices for contract deployment?
Best Approach
Deploy with any method you want (even a MNEMONIC stored in a .env file) then immediately transfer the ownership of the contracts to a Gnosis Safe multisig controlled by multiple signers. ...
5
votes
Contract has not been deployed to detected network
Contract has not been deployed to detected network (network/artifact
mismatch)
I see many different problems with your code, but not what you mentioned in your question. I cloned your github repo ...
5
votes
Truffle deploying without linking
Calling library functions declared as internal, such as those in SafeMath and Math above do not require the calling contract to be linked to the library contract as they will be copied into the ...
5
votes
Accepted
Is it OK to use the reset flag with every Truffle compile and migrate when using the TestRPC client?
The --reset flag will force to run all your migrations scripts again. Compiling if some of the contracts have changed. You have to pay gas for the whole migration again. For ganache/testrpc it should ...
5
votes
Accepted
What is use of HDWalletProvider in Truffle config?
The Truffle HDWallet provider is a convenient and easy to configure network connection to ethereum through infura.io (or any other compatible provider).
For example the HDWallet provider add some ...
5
votes
Accepted
Quorum privateFor not working with truffle-hd-wallet-provider
Updated:
Since Quorum v2.2.1, we now support remote signing for raw (read signed) private transactions. The API is explained in several places, but a great starting point is Quorum.js hosted here: ...
4
votes
What is use of HDWalletProvider in Truffle config?
When deploying a contract you eventually need to sign a transaction with an account (with a private key).
This account management process is handled by the provider, in this case, the @truffle/...
4
votes
How to get a deployed contract instance in truffle console that was deployed without a migration?
Does anyone how, in the truffle console, I can interact with contracts deployed
through other contracts?
To see the list of contracts already deployed on the Truffle Develop network, this command ...
4
votes
Best practice for sharing truffle build files between developers
I don't know if there is a real answer for that, but I use this solution: I change the migration file and I write the ABI and its address after the deploy
var fs = require('fs');
var MyContract = ...
4
votes
Accepted
Prevent 'truffle test' from invoking 'truffle deploy (migrate)'
The truffle test command-line uses the development network configuration.
In other words, it is in fact equivalent to truffle test network=development.
So I solved this problem by adding in each one ...
4
votes
Accepted
How do I determine the network within a truffle exec script?
Not sure if this is the best method, but the arguments you pass to truffle, including the network, are available under process.argv.
script.js:
process.argv.forEach(function (val, index, array) {
...
3
votes
Deploying smart contracts with truffle and geth in windows
truffle.cmd migrate network --ropsten
should be
truffle.cmd migrate --network ropsten
With truffle.cmd networks you can check which networks are available from your truffle.js.
3
votes
Accepted
How do I implement simple JS code to deploy a compiled smart contract to ganache-cli?
After more than a week of google searches, scouring stack exchange, combining bits and pieces of what I found, and with my own trial and error, I finally came up with everything needed to successfully ...
3
votes
Accepted
Deploy new contract through another contract function in Truffle
1.) You can make the function emit an event that broadcasts the new address and then check the logs of the transaction receipt. Receipt
// Solidity
function createNewContract(string memory name, ...
3
votes
Error: HelloWorld has not been deployed to detected network (network/artifact mismatch)
It looks like you deployed to the development network but are running truffle console with the default network, so assume that these are different.
You should deploy and use the console on the same ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
truffle-deployment × 183truffle × 116
truffle-migration × 84
contract-deployment × 57
solidity × 45
truffle-contract × 29
web3js × 17
truffle-test × 12
truffle-compile × 12
contract-development × 8
ganache × 7
go-ethereum × 5
dapp-development × 5
infura × 5
gas × 4
javascript × 4
nodejs × 4
ropsten × 4
gas-limit × 4
rinkeby × 4
openzeppelin-contracts × 4
kovan × 4
remix × 3
ether × 3
gas-price × 3