2

These are the steps I took in order to deploy my contracts to rinkeby network:

  1. Created a .rinkeby folder.
  2. Downloaded genesis json for rinkeby from here
  3. Ran this command :

    geth --datadir=$HOME/.rinkeby --light init rinkeby.json

  4. Ran this command :

    geth --networkid=4 --datadir=$HOME/.rinkeby --syncmode=light --bootnodes=enode://a24ac7c5484ef4ed0c5eb2d36620ba4e4aa13b8c84684e1b4aab0cebea2ae45cb4d375b77eab56516d34bfbd3c1a833fc51296ff084b770b94fb9028c4d25ccf@52.169.42.101:30303?discport=30304 --rpc --rpcapi db,eth,net,web3,personal --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*"

  5. After I had geth connected to the network, I used truffle with the following code & command to deploy the contract:

Code:

module.exports = {
  networks: {
    rinkeby: {
      network_id: 4,
      host: '127.0.0.1',
      port: 8545,
      gas: 4000000
    },
  },
  rpc: {
    // Use the default host and port when not using rinkeby
    host: 'localhost',
    port: 8080,
  },
};

Command:

truffle compile; truffle migrate --network rinkeby

This is the error I am getting :

Using network 'rinkeby'.

/usr/lib/node_modules/truffle/build/cli.bundled.js:23538
        throw new Error("Expected parameter '" + key + "' not passed to function.");
        ^

Error: Expected parameter 'from' not passed to function.
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:23538:15
    at Array.forEach (native)
    at Object.options (/usr/lib/node_modules/truffle/build/cli.bundled.js:23536:19)
    at Object.run (/usr/lib/node_modules/truffle/build/cli.bundled.js:66868:12)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:88946:23
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:67033:9
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:66861:7
    at done (/usr/lib/node_modules/truffle/build/cli.bundled.js:155469:5)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:155526:11
    at FSReqWrap.oncomplete (fs.js:153:5)

What is incorrect in the process that I followed? I cant understand why this error is coming and how to remove it.

  • did you compiled the contract with truffle compile? – Sepultura Aug 12 '17 at 9:07
  • Yes, I have updated the step that I missed in my question. – kneelb4darth Aug 12 '17 at 10:04
  • Does your account have enough funds? – Ismael Aug 12 '17 at 17:58
4

The problem was in the truffle.js file.

module.exports = {
  networks: {
    rinkeby: {
      network_id: 4,
      host: '127.0.0.1',
      port: 8545,
      gas: 4000000,
      from: <your account address>
    },
  },
  rpc: {
    // Use the default host and port when not using rinkeby
    host: 'localhost',
    port: 8080,
  },
};

Just needed to add a from: <account address> into rinkeby's config information.

0

I've had my fair share of hardship with truffle config. I've made my on little lib for deployment using ethers.js. Hopefully this can be of help to someone in the future:

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 runICODeployment = async () => {
    const contractWrapper = await deployer.deploy(ICOTokenContract);
    const transferTransaction = await contractWrapper.contract.transferOwnership(randomAddress);
    const result = await contractWrapper.verboseWaitForTransaction(transferTransaction.hash, 'Transfer Ownership');
}
runICODeployment()

Place this in a js file and run it via node

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.