EatTheBlocks Forum

Workflow for developing Decentralized Application with Truffle

I received this question from a student:

"
I am lost. What’s the order of the commands when you develop a decentralized application with Truffle?
"

Smart contract:

  • Step 1: Create a project with with truffle init
  • Step 2: Code smart contract in contracts folder
  • Step 3: Write migration file in migrations folder
  • Step 4: Start a local development Blockchain with truffle develop
  • Step 5: Deploy smart contract with migrate --reset

Frontend:

  • Step 1: Create a folder for frontend code, in the Truffle project
  • Step 2: Code your frontend
  • Step 3: Integrate your frontend with the compilation artifact of Truffle. i.e you need to import the json document produced by truffle when compiling your smart contract, which also happens automatically when deploying your smart contract. By default this json document is inside the build/contracts folder. It will give you the ABI and the address of the contract.
  • run your frontend (npm start maybe? depends on how you coded it)