Migration and deployment in Truffle
Migration scripts in Truffle are used for deploying your contracts to an Ethereum network. Scripts are written in JavaScript and you can create new migration scripts throughout the development process. You will learn about creating and running these scripts from this recipe.
Getting ready
You need to have Truffle installed on your machine to try this recipe. Ensure that you have a working Ethereum network to connect and test these scripts.
How to do it...
- Create and store migration scripts in the
./mirations
directory. You can find the directory at the root of your project. - Each file follows a naming convention that includes a number and description. The number denotes the order of execution and is used to record the status of migration. The suffix includes a human-readable description of the scripts:
2_token_migration.js
- In the migration script file, include the required import statements followed by the deployment steps:
// Import statement var contract = artifacts...