Desenvolvimento de Smart Contracts com Node.js, Solidity, Truffle :
- mkdir zero2hero-solidity-lesson1 && cd zero2hero-solidity-lesson1
- npm init -y # cria projeto Node.js
- truffle init # cria projeto Truffle
- npm install --save-dev truffle
- npx truffle compile
- npm install --save-dev ganache-cli
- npx ganache-cli --deterministic
- npx truffle migrate --network development # --reset se necessário
- npx truffle console --network development
- const lesson = await Lesson.deployed();
- await lesson.setLesson("Solidity")
- await lesson.getLesson()
- (await lesson.getLesson()).toString()
Como usar os Contratos OpenZeppelin
- npm install --save-dev @openzeppelin/contracts
Testes Unitários
- Certifique-se de que você está executando uma blockchain local (Ganache)
- npm install --save-dev chai
- npx truffle test
Recursos:
Teste Unitário - Guia de Testes do Moloch:
————
Rasim Sen - Arquiteto de Blockchain
zero2hero
WhatsApp: +447470914266
Meetup: zero2hero-training
YouTube: zero2hero.training
Twitter: zero2hero_uk
Facebook: zero2hero.training
Instagram: zero2hero.training
Email: info@zero2hero.training