I have a few question regarding Truffle, Ganache, and testing:
When I execute
truffle develop
and get 10 accounts and 10 private keys, do those represent my accounts in my wallet or other users? For example, are they supposed to represent what shows up inmsg.sender
, which is myself, or accounts that I can interact with by sending funds or processing them in my smart contract.How are the 10 accounts on Ganache different from the 10 accounts from question #1? Do these 10 accounts on Ganache represent the account in my wallet or other users? Are they the same except Ganache's accounts are on
HTTP://127.0.0.1:7545
whereas the Truffle generated accounts are onhttp://127.0.0.1:9545/
?When I perform the Mocha test, do the
accounts
that are being passed as an argument represent my own accounts in my wallet? For example, are they the 10 accounts generated bytruffle develop
?
contract("Some test", async (accounts) => {
console.log(accounts)
});
- Someone said "migration contract helps keep track which migrations have been executed already. So the process is to create a new migration file with an increased number and to deploy just run truffle migrate." Is migration similar to versioning different contracts?
module.exports = function (deployer) {
deployer.deploy(ASmartContract); // is this migrating or deploying?
};
Where are different versions stored and selected is the above process?
- I've seen some tests that deploy the contract:
let instance = await SomeSmartContract.deployed();
whereas other tests simply instantiate it through its constructor without deploying:
let someSmartContract = await SomeSmartContract.new();
Is there any difference between the two?
- I learned that the Solidity Compiler compiles the contract definition into two things: byte code ready for deployment and ABI. 1) Is it only necessary to compile when you make changes to the Solidity contract or other things like the front end code or the tests? 1) Is it necessary to compile each time before performing a test or only once before deploying/migrating? 2) Does the command "truffle migrate --reset" also compile automatically before migrating?