码迷,mamicode.com
首页 > 其他好文 > 详细

[Contract] Truffle 使用流程

时间:2020-02-18 14:43:23      阅读:86      评论:0      收藏:0      [点我收藏+]

标签:demo   compile   led   scripts   ati   cat   placed   init   npm   

 

Installation

 

$ npm install -g truffle

 

Choose ethereum client (Ganache OR truffle build in `truffle develop`)

https://www.trufflesuite.com/docs/truffle/reference/choosing-an-ethereum-client

 

Creating a project

 

$ mkdir truffle-hello 

$ cd truffle-hello

 

$ truffle init  # without default contract

OR

$ truffle unbox <box-name>  # box-name like MetaCoin

 

Compiling Contracts

 

$ truffle compile  # all placed in build/contracts/, dot not edit these .json files

 

Running Migrations

 

$ truffle migrate [--reset]  # run scripts that located in migrations/,Be sure have Ganache installed and running, default choose Ganache network

 

Deployer https://www.trufflesuite.com/docs/truffle/getting-started/running-migrations#deployer

 

Testing Contracts

 

$ truffle test [./tests/hello.js]  # NOTE:  default network is ‘development‘, so truffle-config.js network configuration need to match the Ganache host and port

 

Writing tests in javascript

 

$ truffle test

https://www.trufflesuite.com/docs/truffle/testing/writing-tests-in-javascript

 

demo: https://github.com/farwish/truffle-hello.git

docs:https://www.trufflesuite.com/docs/truffle/getting-started/installation

tutorial1/2/3: https://www.youtube.com/watch?v=2fSPn0-8ORs

link:https://www.cnblogs.com/farwish/p/12310551.html

[Contract] Truffle 使用流程

标签:demo   compile   led   scripts   ati   cat   placed   init   npm   

原文地址:https://www.cnblogs.com/farwish/p/12326022.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!