Ethereum Smart Contract Programming 201 - Truffle Hello World

in the Truffle Hello World video, Fhilip showed us after running “truffle init” to initialise the truffle project, there should be a migration.sol and 1_initial_migration.js in the contracts and migrations folder respectively. However in the current version of Solidity for VS Code (not sure does it have the same issue in other IDEs), I’ve looked Solidity Gibhub link and apparent as of v5.5.27, it no longer auto generates the Migration.sol and 1_initial_migration.js files when initialising truffle.

So does this mean I need to hand type in this two files? or we actually doesn’t need it?
From the git hub link I included above, it gives me the impression that on chain migration (I assume that’s what Migration.sol and 1_initial_migration.js is doing) is not a good idea, and thus it prompts the remove of the auto generation of this two files.

What is the best industry practice to approach this? and how should I solve this issue before continuing with the course?

thanks.

1 Like

Hi @Philip_Wong
Hope you are doing well.

You are correct, the latest version of truffle doesn’t generate the sample Migration.sol or .js files.
The code from these files are just sample code and is not used in the tutorial, so you can proceed to create a hello.sol as shown in the tutorial.

However if you are looking for any same truffle projects for a sample contract or migration code, there is a new way to get that by using truffle boxes.
You can install an example code by running the following command in terminal.

truffle unbox metacoin

This is not required for completing the tutorial but in case if you are installing make sure not to override existing project files.

Check the truffle docs for more details
https://trufflesuite.com/docs/truffle/how-to/create-a-project/

1 Like

Hi @JohnVersus,
Thanks for the reply, much appreciated. a follow up question, why is it so they removed the auto generated migration files? also what exactly does “unbox” do?

I am not sure why the auto-generated files are removed in newer versions.

The truffle unbox command downloads some sample project files and adds them to your truffle project. truffle unbox metacoin command adds the contract, migration files related to a project named metacoin.

1 Like