To work with our contracts, we first need to migrate these contracts to our test blockchain. Migrations carry out the following tasks:
- They deploy the compiled contract code to the blockchain.
- They establish interlinking between dependent contracts.
- They initialize the initial values through the constructor.
- Lastly, and most importantly, they manage the different versions of the contracts deployed. In the traditional model, every time a contract is deployed, a new Ethereum address is generated that then needs to be updated to the code of the blockchain application. Truffle allows us to abstract this concept and invoke the contract directly through a contract object instead of the address.
To deploy the smart contracts, first bring your Ganache blockchain online. Make sure your Ganache test server is running on localhost:8545....