-
Create folder.
-
Add
package.json
file to this project and add below content.{ "name": "eth-swap", "version": "0.1.0", "description": "An Ethereum Marketplace", "author": "gregory@dappuniversity.com", "dependencies": { "babel-polyfill": "6.26.0", "babel-preset-env": "1.7.0", "babel-preset-es2015": "6.24.1", "babel-preset-stage-2": "6.24.1", "babel-preset-stage-3": "6.24.1", "babel-register": "6.26.0", "bootstrap": "4.3.1", "chai": "4.2.0", "chai-as-promised": "7.1.1", "chai-bignumber": "3.0.0", "identicon.js": "^2.3.3", "react": "16.8.4", "react-bootstrap": "1.0.0-beta.5", "react-dom": "16.8.4", "react-scripts": "2.1.3", "truffle": "5.0.5", "web3": "1.0.0-beta.55" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": [ ">0.2%", "not dead", "not ie <= 11", "not op_mini all" ] }
-
Add
.gitignore
and add below content.# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp .pnp.js # testing /coverage # production /build # misc .DS_Store .env .env.local .env.development.local .env.test.local .env.production.local npm-debug.log* yarn-debug.log* yarn-error.log*
-
Run command
npm install
in package.json directory -
Add below snippet in
truffle-config.js
.require('babel-register'); require('babel-polyfill'); module.exports = { networks: { development: { host: "127.0.0.1", port: 7545, network_id: "*" // Match any network id }, }, contracts_directory: './src/contracts/', contracts_build_directory: './src/abis/', compilers: { solc: { optimizer: { enabled: true, runs: 200 }, evmVersion: "petersburg" } } }
-
Run
truffle compile
to check for the compilation error -
Migrate contracts on blockchain using command
truffle migrate
-
If already migrated once and want to re-migrate use reset flag
truffle migrate --reset