I am new to all this, spent over 15hrs in the past 24 hrs to deploy based on directions here : https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6

I made simple changes changes because I want to deploy to ropsten and then mainnet. Initial migration works, but get an error at 2_deploy_contracts. I tried the fix the author mentioned in comments, it wont change anything.

I've googled and looked everything, BUT still get the same error for both networks. Error:

Error: Web3ProviderEngine does not support synchronous requests. at ProviderError.ExtendableError (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:9401:17) at new ProviderError (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325054:24) at C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325137:17 at HDWalletProvider.send (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:325175:22) at Object.send (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176170:31) at RequestManager.send (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:329502:32) at Eth.get [as blockNumber] (C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:41602:62) at module.exports (C:\Users\g\Documents\bootstrap-3.3.7\bootstrap-3.3.7\docs\examples\carousel\my-ico\migrations\2_deploy_contracts.js:3:48) at C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:176043:7 at C:\Users\g\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:203731:7 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

Here is my 2_deploy_contracts:

const MyCoinCrowdsale = artifacts.require("MyCoinCrowdsale") module.exports = function(deployer, network, accounts) {
web3.eth.getBlock(web3.eth.blockNumber, (e, block) => { if(!e) { const startTime = block.timestamp + 1 //one second in the future const endTime = startTime + (86400 * 20) // 20 days const rate = new web3.BigNumber(1000) const wallet = accounts[0] deployer.deploy(MyCoinCrowdsale, startTime, endTime, rate, wallet) } }) };

1 Answer 1


web3.eth.blockNumber is synchronous. You need to change this to web3.eth.getBlockNumber((err, res) => {})

Alternatively you can restructure this chain with promises:

const Promise = require('bluebird');
const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider(<WEB3_PROVIDER_URL>));

if (typeof web3.eth.getAccountsPromise === 'undefined') {
  Promise.promisifyAll(web3.eth, { suffix: 'Promise' });

Then you can do:

.then(_blockNumber => web3.eth.getBlock(_blockNumber))
.then(_block =>   { YOUR BLOCK CODE })
  • This worked. Used 1st approach. Thank you so much. It seems that I have pending transactions that I cant get rid and keep getting replacement transaction underpriced error. I tried MEW offline transaction to clear them out but doesn't seem to work. My address does not have any pending transactions. Any recommendations?
    – G.T.
    Jan 11, 2018 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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