This quick and dirty tutorial will show you how to create Ethereum Smart Contract project using truffle framework.
Installation
Installing node and npm, here is a great tutorial but most of you should already have this setup
Install truffle framework
Creating the project
Create a folder to be used for the project files and and open terminal inside.
Initialize Truffle Framework - Creates the basic project layout
Initialize npm
Creating a contract in the contracts folder
Creating a contract test file in the tests folder
Usefull Pacakges
All these are optional but usefull for me
OpenZeppelin
OpenZeppelin is a great library of ethereum smart contracts
Truffle Flattener
truffle-flattener is a tool to create single contract without any imports. This is usefull for when you sending your contract for audit or you want to deploy.
To run
Solidity-Coverage
Solidity-Coverage is used to test code coverage of test cases
Configuration is done via a file .solcover.js in the root of the project.
- port - Port to run testrpc on / have truffle connect to
- copyNodeModules - Copies specific node_modules packages into the coverage environment. If you using OpenZeppelin this is going to be needed.
- skipFiles - Contracts to be skipped
- norpc - Prevent solidity-coverage from launching its own testrpc
To run execute