1

When I enter truffle console and start interacting with the deployed contract truffle uses the first address, how to change the address for testing ?

user@user:~/workspace/smart-contract$ truffle console 

truffle(ganache)> setAddress("0x0000000....); // how to set the addres ? 
0

1 Answer 1

1

Edit the truffle.js file for truffle to use some address other than the default address which just happens to be the first address in your Ganache blockchain. You can do that by assigning any available ganache address to the from property in the file.

1
  • do you actually mean truffle-config.js ? here is the configuration and it doesn't work: advanced: {port: 7545, network_id: 5777,gas: 8500000,sent with each transaction (default: ~6700000) gasPrice: 20000000000, // 20 gwei (in wei) (default: 100 gwei) from: "0xf1174C51Bf83fD36fB2E6Eec4A469Db879A6aa94", // Account to send txs from (default: accounts[0]) websockets: true // Enable EventEmitter interface for web3 (default: false) }
    – Adelin
    Commented Jan 17, 2019 at 11:44

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