24

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 fixed 32k gas. This is of course on top of the 21k gas of a normal tx. Note: During contract creation from an EOA (non-contract address), the CREATE opcode isn'...


14

truffle deploy is an alias for truffle migrate. They both do the same thing.


8

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(); let receipt = await web3.eth.getTransactionReceipt(someInstance.transactionHash); assert.isBelow(receipt.gasUsed, 4700000); });


7

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 hexadecimal, which will be double the size and throw the gas error. I also re-installed truffle wallet provider using $ sudo uninstall truffle-hdwallet-...


7

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 MyContract. new(): Deploy a new version of this contract to the network, getting an instance > of MyContract that represents the newly deployed instance. ...


6

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 transactions pay this (Gtransaction) 32000 because is a contract creation (Gcreate) Your transaction will have input data, which will cost you in gas: 4 for ...


6

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 make it migrate using: ganache-cli --gasLimit=0x1fffffffffffff --allowUnlimitedContractSize -e 1000000000 --allowUnlimitedContractSize: "Allows unlimited ...


5

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 and launched the app with npm run dev. NOTE: Errors from the screenshot are not related to the original question. If you are curious these errors seem to ...


5

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 experience gasPrice setting in truffle.js is effective. I have successfully deployed my contracts using the following syntax: geth_mainnet: { host: "127.0.0.1"...


5

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 run could affect the results of a subsequent run, making your test suite non-deterministic. But I wanted to preserve state between runs of truffle test. The ...


5

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: https://github.com/jpmorganchase/quorum.js/ Original: answered Sep 10 '18 at 18:54 At the moment, Quorum does not support sending signed / raw txns that are ...


4

If your contract costs that much, then you must do a bunch of storage initialization. Storage, by far, costs the most to read/write. The irony of solidity is that it cost less to redo things in memory so if you have some variables you can re-initialize and recalculate, it's probably better to do so in memory each time a contract method is called.


4

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 works: truffle(develop)> networks [--clean] Network: develop (id: 4447) Migrations: 0xfb88de099e13c3ed21f80a7a1e49f8caecf10df6 MyNewContract: ...


4

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 calling contract's bytecode during compilation. Calling library functions declared as public or external will require the calling contract to be linked to the ...


4

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 = artifacts.require('./MyContract.sol'); var fileContent = require('../build/contracts/MyContract.json'); module.exports = function(deployer) { deployer.deploy(...


4

Try to use output parameter: truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol


3

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 not be an issue it is just a extra delay. But for deploying against a public network: mainnet, rinkeby, ropsten, etc. it can be really annoying to have to wait ...


3

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

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 deploy a compiled smart contract ganache. It wasn't easy to figure out. I haven't seen a full solution presented anywhere in my searches, so I wanted to share ...


3

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, string memory symbol, uint256 _maxSupply) public onlyOwner { etnX c = new etnX(name, symbol, _maxSupply, address(store)); emit NewContract(address(c)); } ...


2

You can deploy this contract in enother way: function sendRaw(rawTx) { var privateKey = new Buffer(key, 'hex'); var transaction = new tx(rawTx); transaction.sign(privateKey); var serializedTx = transaction.serialize().toString('hex'); web3.eth.sendRawTransaction( '0x' + serializedTx, function(err, result) { if(err) { ...


2

Correct, contracts like these can't currently be deployed, although it may become possible to deploy them in future if and when miners raise the gas limit. 16M gas sounds like a very big contract; You may want to consider breaking it up into a number of smaller ones.


2

I've done it! You need change your package.json "start": "npm run test", "dev": "lite-server", "test": "lite-server" And add a file bs-config.js with this code: module.exports = { port: process.env.PORT, files: ['.src/**/*.{html,htm,css,js}'], server:{ baseDir: ["./src", "./build/contracts"] }}; Good luck! repo: https://github.com/...


2

I had faced similar issue I am able to resolve it after deleting JSON files from /build/contracts. Then I tried to redeploy the contract and it was done successfully.


2

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 features required by Truffle that are not available with infura like event filtering and transaction signing.


2

Short Answer: Both contracts are creating new instances of Whitelist. They are not sharing the same instance. To share the same instance - they both need to reference the same address of a single deployed Whitelist. By deploying both contracts you are, in fact, wasting (however small or large) gas as both contracts have redundant code. My suggestion (...


2

I upvoted your answer because it seems like a nice template for doing it all with nothing but Web3. This is a good thing to know about but a little tedious, in my opinion. For the benefit of other readers who find this question/answer, the Truffle framework addresses this and other concerns with higher-level abstractions so we don't have to get down in the ...


2

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) { console.log(index + ': ' + val); }); Then: > truffle exec script.js --network development Using network 'development'. 0: /usr/bin/node 1: /usr/bin/...


2

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 network. truffle migrate --network development truffle console --network development As an aside, you shouldn't have to use sudo. You may want to consider ...


1

You need to deploy your DAPP's smart contracts on a test etherium blockchain first and then afterwards you can deploy your DAPP on aws. Docker Link : https://github.com/getamis/istanbul-tools More about etherium testNets: https://medium.com/coinmonks/how-to-deploy-a-smart-contract-to-ethereum-testnet-e34fa5b10dd6


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