Truffle installation - modolee/blockchain GitHub Wiki
Truffle framework ์ค์น
Nodejs ์ค์น
์ค์น ์ค๋น ์คํฌ๋ฆฝํธ ์คํ
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
์ค์น
sudo apt-get install -y nodejs
Truffle ์ค์น
sudo npm install -g truffle
Ganache-cli ์ค์น
sudo npm install -g ganache-cli
Truffle & Ganache๋ฅผ ์ด์ฉํ ์ปจํธ๋ํธ ๋ฐฐํฌ
Truffle ํ๋ก์ ํธ ์์ฑ
์ํ ์ฝ๋ ๋ฐ์ ๋ด๋ ค๋ฐ๊ธฐ
truffle unbox [box ์ด๋ฆ]
์๋ก์ด ํ๋ก์ ํธ ์์ํ๊ธฐ
- ํ๋ก์ ํธ ๋๋ ํ ๋ฆฌ ์์ฑ
mkdir [project ์ด๋ฆ] - ๊ธฐ๋ณธ ํ ์์ฑ
truffle init
์ค๋งํธ ์ปจํธ๋ํธ ์ฝ๋ ์์ฑ
./contracts/[contract ์ด๋ฆ].sol ํ์ผ์ ์ฝ๋ ์์ฑ
Truffle ์ค์
Network ์ค์
./truffle.js ํ์ผ ์์ (ganache-cli๋ ๊ธฐ๋ณธ์ ์ผ๋ก localhost:8545)
Migration ์ค์
- unbox๋ก ์์ํ ๊ฒฝ์ฐ ./migration/2_deploy_contracts.js ํ์ผ ์์
- init์ผ๋ก ์์ํ ๊ฒฝ์ฐ
truffle create migration [contract ์ด๋ฆ]์์ฑ ๋ ํ์ผ(ํ์์คํฌํ_contract_์ด๋ฆ.js) ์์
Ganache-cli ์คํ
ganache-cli
์ปดํ์ผ & ๋ฐฐํฌ
์ปดํ์ผ
truffle compile
๋ฐฐํฌ
truffle migration
์คํ
truffle console