a beginner's tutorial for creating and deploying a simple smart contract using the truffle suite
Node.js is a JavaScript run-time environment required for using Truffle.
- If you don't have homebrew, download the installer and make sure it's on your
$PATH
(if you run into problems with multiple versions, download nvm) - Or use homebrew
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
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
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
- Deploy your contracts
- Test your smart contract with Truffle
- Check out Truffle's documentation for a more comprehensive description of its capabilities