Code Monkey home page Code Monkey logo

truffle's Introduction

truffle

  1. Install node version manager, taking care of "important notes" appart:

https://github.com/nvm-sh/nvm#important-notes

"If you're running a system without prepackaged binary available, which means you're going to install nodejs or io.js from its source code, you need to make sure your system has a C++ compiler. For OS X, Xcode will work, for Debian/Ubuntu based GNU/Linux, the build-essential and libssl-dev packages work."

  1. Install node and node package manager with nvm

nvm intall node 12

  1. install truffle:

npm install -g truffle

  1. install Visual Studio code and extentions: solidity and "solidity visual developer"

  2. unbox react/solidity boilerplate::

truffle unbox react

  1. the unboxed project dir structure:

_ client |_ public (index.html and web accessed files) |_ src (App.js, getWeb3.js, etc javascript react src files) |_ contracts (migrated solidity contract files to .json ABI, Network "web3/blockchain", metadata i.e truffle development => migrate) | package.json (config react scripts, dependencies, browserlist "browsers allowed" i.e react script called for run react web server => npm start) |_ contracts (solidity fileas with src contracts) |_ migrations |2_deploy_contracts.js (name of the solidity contracty file to be mighrated to the selected truffle blockchain) | truffle-config.js (configure default port 8545 from truffle development console blockchain environment and add the compilers vbersion)

****** add compiler version at the end in truffle-config.js:

... }, compilers: { solc: { version: "0.8.1 " } } ...

  1. init truffle project and enter truffle development console:

truffle init

truffle develop

  1. migrate solidity files contracts to truffle dev blockchain:

//inside trufdfle dev console truffle(develop)> migrate

  1. start react web server in another terminal:

trufflePojectDir/client> npm start

  1. access default react web server port 3000:

http://localhost:3000/

**** PRERREQUISITE: Install Metamask and configuire localhost network at port 8545 (provided by default by truffle development environment)

INSTALL CHAI FOR TESTING

npm install --save chai chai-bn chai-as-promised

INSTALL OPENZEPPELIN AND .ENV FILES VARIABLES

npm install --save @openzeppelin/contracts

npm install --save dotenv

***in visual studio code generates an error, solved: import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; Right click on the error. Select "Change the default workspace..." and use lo0cal files

CLONE SPECIFIC DIRECTORY FROM OPENZEPPELIN BRANCH release-v2.5.0 OF CROWDSALE (NOT SUPPORTED IN LATEST VERESIONS)

git init

git remote add OpenZeppelin https://github.com/OpenZeppelin/openzeppelin-contracts.git

git fetch OpenZeppelin

git checkout OpenZeppelin/release-v2.5.0 -- contracts/crowdsale

truffle's People

Contributors

albatros-github avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.