This DApp is for RFAI Portal where users are request for a AI Service. This project also includes necessary contracts and the DApp is built using Drizzle Framework with ReactJS.
-
Install Truffle and Ganache CLI globally. If you prefer, the graphical version of Ganache works as well!
npm install -g truffle npm install -g ganache-cli
-
Clone the code from Github @ https://github.com/singnet/snet-rfai-dapp. Install the dependencies by running npm install Command.
git clone https://github.com/singnet/snet-rfai-dapp cd snet-rfai-dapp npm install
-
Run the development blockchain, we recommend passing in a blocktime. Otherwise, its difficult to track things like loading indicators because Ganache will mine instantly.
// 3 second blocktime. ganache-cli -b 3
-
Compile and migrate the smart contracts. Note inside the development console we don't preface commands with
truffle
.compile migrate
-
Run the webpack server for front-end hot reloading (outside the development console). Smart contract changes must be manually recompiled and migrated. Make sure that the network & contract addresses are updated in the respective locations (build -> contracts)
// Serves the front-end on http://localhost:3000 npm run start
-
Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.
// If inside the development console. test // If outside the development console.. truffle test
-
Test is included for testing React components. Compile your contracts before running Jest, or you may receive some file not found errors.
// Run Jest outside of the development console for front-end component tests. npm run test
-
To build the application for production, use the build command. A production build will be in the build_webpack folder.
npm run build