Skip to content

a tutorial for creating and testing a simple smart contract using the truffle suite

Notifications You must be signed in to change notification settings

Blockchain-at-Michigan/Smart-Contract-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Contract Tutorial

a beginner's tutorial for creating and deploying a simple smart contract using the truffle suite

1. Install Node.js

Node.js is a JavaScript run-time environment required for using Truffle.

2. Install Truffle

The Truffle Suite is a development environment for blockchains using the Ethereum Virtual Machine.

  • Use npm install -g truffle to install the Truffle package globally, or remove the tag to install locally
  • If you're using Ubuntu on a Windows machine and the previous command won't execute, try using Powershell instead
  • Check out the repo

3. Download and Install Ganache

Ganache is a personal blockchain for Ethereum development that allows you to test locally and much faster than major testnets like Ropsten and Rinkeby.

4. Download the starter code and fill out the functions

The Source Tracker smart contract represents a simplified supply chain for a given product shipment. Each time the shipment arrives at a new node in the supply chain, the contract adds another "node" to its supply chain array. On a larger scale, this example shows how blockchain can be used along with IoTs to make supply chains more safe and transparent.

  • Here's a list of functions that need to be implemented
  • If you like to develop in Visual Studio Code, you can download this extension for Solidity support
  • If you like to develop in Atom, you can download this extension for Solidity support

5. Debug your code using Remix

Remix is a web-based compiler/IDE that is one of the best options for testing your smart contracts with the compiler of your choice

6. Test your smart contract using Truffle and Ganache

7. Check your code with the solution code

8. For more practice, check out Truffle's Pet Shop Tutorial

About

a tutorial for creating and testing a simple smart contract using the truffle suite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published