2

I am currently following this tutorial: https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f

The way I deployed the contract was by using truffle migrate command which presumably automatically pushes it to the newtwork from a certain account which I should have created earlier using web3 library, specifically web3.personal.newAccount('some_password').

Considerring I have created multiple accounts, which one owns the contract i.e. what account gets ether taken from? (is it the latest I have created)

user6396911
  • 123
  • 1
  • 6

2 Answers2

0

If you don't set the default account in your Truffle config, it will use the first account returned from web3.eth.getAccounts().

From the Truffle docs:

  • gas: Gas limit used for deploys. Default is 4712388.
  • gasPrice: Gas price used for deploys. Default is 100000000000 (100 Shannon).
  • from: From address used during migrations. Defaults to the first available account provided by your Ethereum client.
  • provider: Default web3 provider using host and port options: new Web3.providers.HttpProvider("http://:")

To specify the default address, add from to the network environment configuration.

Example truffle.js:

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*",
      from: "0x65463bf6268e5cc409b6501ec846487b935a1446"
    }
  }
};
Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48
0
  1. Truffle. You can specify an account from the from.You can check this document http://truffleframework.com/docs/advanced/configuration

  2. You need unlock this account.

Roman Patutin
  • 2,171
  • 4
  • 23
  • 27
Aaron
  • 19
  • 3