Skip to content

Migration and Compilation

Let's see if we can deploy the smart contract to a developer-only test blockchain.

Configuring Migrations

Add in a migration in "migrations/2_deploy_contracts.js":

var MyToken = artifacts.require("./MyToken.sol");

module.exports = async function(deployer) {
    await deployer.deploy(MyToken, 1000000000);
};

Also lock in the compiler version in truffle-config.js:

const path = require("path");

module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
contracts_build_directory: path.join(__dirname, "client/src/contracts"),
networks: {
    develop: {
    port: 8545
    }
},
compilers: {    
    solc: {
    version: "^0.6.0"
    }
}
};

Running Migrations

Try to run this in the truffle developer console:

truffle develop

and then simply type in

migrate

Last update: April 29, 2022