-
Install Truffle globally.
npm install -g truffle
-
Install dependencies
npm install
-
Run the development console.
truffle develop
-
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.
// Serves the front-end on http://localhost:3000 npm run start
-
To build the application for production, use the build command. A production build will be in the build_webpack folder.
npm run build
- Get Test Accounts ganache-cli documentation
npm install -g ganache-cli
ganache-cli
-
Import a test account into Metamask
-
Set MetaMask to Private Network
new RPC network: localhost:127.0.0.1:8545
- Uncomment code from truffle.js/truffle.config.js
Windows use truffle.config.js
Mac/Linux use truffle.js
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
//use with metamask
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
}
}
};
- Change web3 network
cd TicketCrypt/src/utils/getWeb3.js
\\change url from http://127.0.0.1:9545 to http://127.0.0.1:8545
var provider = new Web3.providers.HttpProvider('http://127.0.0.1:8545')
Contract not deployed to network? - turn off metamask
Why am I getting a gyp: No Xcode or CLT version detected!
error after running npm install?
- See this post
Working on a branch and missing npm dependencies?
Run npm install <insert-library>