Skip to content

oliviazhang111/Truffle_DApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Truffle_DApp

Please find more on How to build your ERC20 token and launch an ICO

1.npm install web3 latest// npm ls web3// npm install web3@0.19

  1. 安装node.js 8.11.2 LTS $ npm i -g npm@5.4.2 npm ls-remote nvm install v8.8.1 -----nodejs version switch nodejs version $ nvm use $nvm ls $nvm aliasdefault 8.8.1

  2. 安装Truffle $ npm install -g truffle

  3. 创建项目 $ mkdir MetaCoin $ cd MetaCoin $ truffle unbox metacoin

  4. 编译智能合约 $ truffle compile

  5. 部署智能合约 要部署我们的智能合约,我们需要一个客户端来与区块链进行交互。推荐使用Ganache-cli(Ganache命令行版,原ethereumjs-testrpc), 是一个适用于开发时使用的客户端,是Tuffle套件中的一部分。

6.1 下载安装 module.exports = { networks: { development: { host: "x.x.x.x", port: 8545, network_id: "*" } } };

6.3 启动Ganache-cli,创建区块链 $ ganache-cli -h x.x.x.x 创建了与区块链交互时可以使用的10个帐户(及其私钥),默认发送账户为第一个

6.4 将合约迁移到由Ganache-cli创建的区块链 $ truffle migrate --network ganache 显示了已部署合约的交易ID和地址

  1. vi package.json dev:"webpack-dev-server --host 0.0.0. web3来与智能合约进行交互 $ npm run dev open x.x.x.x:8545 check metacoin balance

8.install metamask/ import account from ganache-cli

9.set private network x.x.x.x:8545

$ sudo npm install -g ganache-cli

6.2 修改Tuffle.js文件为以下内容:(port=8545,host=当前服务器ip)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors