Skip to content

Repository skeleton to help you build or start with the development of Smart contracts for Ethereum blockchain written in Solidity language.

License

Notifications You must be signed in to change notification settings

Shimmi/smart-contracts-skeleton

Repository files navigation

Skeleton for Ethereum Smart Contracts

Jump start your Smart Contracts development with no configuration.

This skeleton repository gives you a good foundation for building or starting with the development of Smart contracts for Ethereum blockchain written in Solidity language.

Quickstart

  1. Clone this repo.
  2. Run npm install.

That's all!

What’s Included?

  • Truffle framework: The most popular development framework for Ethereum.
  • OpenZeppelin: Framework of reusable and secure smart contracts in the Solidity language.
  • Solium: Linter to identify and fix style & security issues in Solidity.
  • Solidity Coverage: Code coverage for Solidity testing.
  • Babel: Compiler for next-generation Javascript.
  • Mocha: Javascript testing framework.
  • Chai: Javascript BDD/TDD assertion library.

Requirements

The only (base) requirement is Node with NPX.

Note: If you are developing on Windows the "Bash on Linux on Windows" is highly recommended for running code coverage. If you want to run it directly in Powershell/cmd, follow this guide (Not recommended).

(npx is bundled with npm 5.2+ and higher.)

Usage

Testing

Tests are located in test/ folder and are mostly written in javascript. This skeleton gives you preconfigured support for ES2015+ features. Thanks to the new import, async/await and arrow functions the tests are much cleaner and simpler.

See the Mocha and Chai documentation for writing tests.

npm test

Compiling

The contracts are compiled automatically when running the commands (e.g. npm test, npm run migrate, ..). Yet it can be handy to run the compilation manually as then the files are persisted and not deleted on command exit.

Running the compile method will generate a build/ folder with JSON files containing the contracts bytecode, source map, abi and more. This can speed up running the tests as it will not recompile them on every run (unless changing the contracts code).

npm run compile

Generating code coverage

Running the code coverage command will generate a coverage/ folder. Open the index.html to view the results.

npm run coverage

Linting the code

Linting will statically analyze your code to identify style & security issues.

npm run lint

Migrating to the network

To publish and interact with your contracts, you will need to "migrate" them.

This changes and may need a bit of configuration depending to which network and/or RPC you are deploying.

Please see Truffle's Ganache or Geth's geth --dev command for running personal developer blockchain.

npm run migrate

About

Repository skeleton to help you build or start with the development of Smart contracts for Ethereum blockchain written in Solidity language.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published