Portal
Search…
Setup truffle

​
πŸ“
Truffle config

create and edit truffle-config.js:
truffle-config.js
1
module.exports = {
2
contracts_build_directory: "./src/contract_build",
3
compilers: {
4
solc: {
5
version: '0.5.2'
6
}
7
},
8
};
Copied!
We specified to use solc version 0.5.2 as the contract compiler and we set the contract build directory to ./src/contract_build because the default build directory is ./build which conflicts with react application build folder. Another reason is later on we'll use react to load the Counter.json from the build directory which must be located inside the src directory.

​
πŸš—
Test out

You can check if it's setup correctly by running truffle compile
1
truffle compile
Copied!
The command will success and print something like:
1
Compiling your contracts...
2
===========================
3
> Everything is up to date, there is nothing to compile.
Copied!
truffle compile will check the contracts which needs compile to evm byte code. Truffle thinks everything is update to date since we're not having any smart contract in this project.
Last modified 9mo ago
Copy link