:~workspace/myproject$truffle migrate --reset

Compiling your contracts...

Everything is up to date, there is nothing to compile.

Running migration: 1_initial_migration.js Replacing Migrations... Migrations: 0xA501AfD7d6432718daF4458Cfae8590d88de818E Saving successful migration to network... Saving artifacts... Running migration: 2_deploy_simplestorage.js Deploying SimpleStorage... Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: Invalid number of parameters for "undefined". Got 2 expected 1! at Object.InvalidNumberOfParams (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/~/web3-core-helpers/src/errors.js:32:1) at Object._createTxObject (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:699:1) at Contract.deploy (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3-eth-contract/src/index.js:504:1) at Function.deploy (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/execute.js:214:1) at constructor.detectNetwork.then.network (/usr/local/lib/node_modules/truffle/build/webpack:/packages/truffle-contract/lib/contract/constructorMethods.js:56:1) at at process._tickCallback (internal/process/next_tick.js:189:7) Truffle v5.0.12 (core: 5.0.12) Node v8.16.0


You didn't paste the script you're using for the deployment, however from the error it looks like you're passing two parameters to the simple_storage contract constructor whereas it only expects one (the value to initialise the storage value to).

Here is a copy from my environment:

// Pass 42 to the contract as the first constructor parameter
deployer.deploy(simple_storage, 42, {privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})

If you are passing the correct number of parameters then try deleting the contents of the 'build' directory and redeploying.

  • Thanks for your reply, the problem was due to use of privateFor, I got it right after upgrading to latest version of Truffle seeing your answer to another question – Hit Vardhan Jun 4 at 6:37

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.