Mid and Final term discussion

Get account addresses when testing/migrating with truffle

Re: Get account addresses when testing/migrating with truffle

by ANDREA LISI -
Number of replies: 0

Do not worry, is not easy the first time to manage tools like truffle. It's a bit confusing:


Here, https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#available-accounts, you can find how to get the account list from your provider (Ganache in the example).

The exported function (module.exports, a NodeJs thingy) can accept up to three aruguments: deployer, network (the current target network) and accounts.
accounts is what you need, and it should be the array of addresses provided by Ganache (try to print it out) and you can access to the acocunt you wish with accounts[i].