0

I'm trying to follow the tutorial on using Truffle framework for Ethereum development at https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f.

Unfortunately I'm not able to successfully deploy the compiled contract to Ropsten testnet with

truffle migrate

in the Truffle console. The following error keeps showing up:

Error: intrinsic gas too low

I know it has something to do with a too low amount of gas being used in the transaction which deploys the contract to the testnet.

I've already tried different settings of gas in truffle.js for development which were all below the result of:

web3.eth.getBlock("pending").gasLimit

But I assume this has nothing to do with my problem.

I also found https://stackoverflow.com/questions/42589091/ethereum-truffle-metacoin-fails-with-intrinsic-gas-too-low but there the solution was to change the gas limit in genesis.json. As I want to deploy to testnet that's not an option in my case.

I'm pretty sure I'm missing a configuration setting in Truffle.

2

Ok, I found it by myself ;)

I overlooked to increase the gas option in file

2_deploy_contracts.js

file which was set to 21000 as it was automatically created by Truffle.

Changing it to 290000 solved the issue.

0

I've found that truffle.js configs has caused me a bit of a problems, especially on the mainnet. I've started deploying via ethers.js (I've abstracted the deployment in a little library) and it's been better:

const etherlime = require('etherlime');

const ICOTokenContract = require('./build/contracts/ICOToken.json');

const randomAddress = '0xda8a06f1c910cab18ad187be1faa2b8606c2ec86';

const defaultConfigs = {
    gasPrice: 20000000000,
    gasLimit: 4700000
}

const deployer = new etherlime.InfuraPrivateKeyDeployer('Your Privste KEY', 'ropsten', 'Your infura API key', defaultConfigs);

const runICO = async () => {
    const contractWrapper = await deployer.deploy(ICOTokenContract);
    const transferTransaction = await contractWrapper.contract.transferOwnership(randomAddress);
    const result = await contractWrapper.verboseWaitForTransaction(transferTransaction.hash, 'Transfer Ownership');
}

P.S. Would love feedback on what I've built as lib

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.