15

How do you select an account to deploy a contract using: 1)Metamask 2)Parity 3)some config file

1 Answer 1

20

I figured it out. in truffle.js you can specify from: field like this:

// Allows us to use ES6 in our migrations and tests.
require('babel-register')

module.exports = {
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*', // Match any network id
      from: '0xA21983B35C767CF8609D95F4886C9A18A194D8AA'
    }
  }
}

3
  • 3
    that's the public address, but how does truffle knows the associated private key? Commented Sep 29, 2017 at 7:04
  • @David天宇Wong it doesn't need to know, your geth/parity node doesn't even know it. You have to unlock your key
    – rstormsf
    Commented Oct 1, 2017 at 2:02
  • 2
    It needs to know it to sign transactions coming from this address. If you deploy a contract you need to sign the transaction deploying that contract. Commented Oct 2, 2017 at 20:55

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.