青云平台搭建truffle

1安装node
直接在nodejs官网下载nodejs-v6.10.x编译好的压缩包(tar.gz), 里面自带了npm(推荐此方法)。

下载成功后,cd 到nodejs下载的目录,直接把nodejs解压到/usr/local中。

wget https://nodejs.org/dist/v8.1.2/node-v8.1.2-linux-x64.tar.xz
root@i-5tthrr8u:/home/ubuntu#tar -xvf node-v8.1.2-linux-x64.tar.xz -C /usr/local/

查看/usr/local目录如下:
root@i-5tthrr8u:/home/ubuntu# ls /usr/local
bin  etc  games  include  lib  man  node-v8.1.2-linux-x64  sbin  share  src
root@i-5tthrr8u:/home/ubuntu# vim ~/.profile

设置PATH环境变量,编辑~/.profile,并在末尾添加node文件夹路径到$PATH环境变量中。


# ~/.profile: executed by Bourne-compatible login shells.

if [ "$BASH" ]; then
  if [ -f ~/.bashrc ]; then
    . ~/.bashrc
  fi
fi

mesg n || true
PATH="$HOME/bin:$HOME/.local/bin:/usr/local/node-v8.1.2-linux-x64/bin:$PATH"

检查nodejs,注销或者重启电脑(.profile)中设置的$PATH需要重启,或者在终端中运行: source ~/.profile

root@i-5tthrr8u:/home/ubuntu#  source ~/.profile
root@i-5tthrr8u:/home/ubuntu# node --version
v8.1.2
root@i-5tthrr8u:/home/ubuntu# npm --version
5.0.3

2:安装truffle 和 testrpc


root@i-5tthrr8u:/home/ubuntu# sudo npm install -g truffle
bash: sudo: command not found
root@i-5tthrr8u:/home/ubuntu# npm install -g truffle
/usr/local/node-v8.1.2-linux-x64/bin/truffle -> /usr/local/node-v8.1.2-linux-x64/lib/node_modules/truffle/build/cli.bundled.js
+ truffle@3.3.2
added 90 packages in 80.11s

查看版本
root@i-5tthrr8u:/home/ubuntu# truffle
Truffle v3.3.1 - a development framework for Ethereum

Usage: truffle <command> [options]

Commands:
  init      Initialize new Ethereum project with example contracts and tests
  compile   Compile contract source files
  migrate   Run migrations to deploy contracts
  deploy    (alias for migrate)
  build     Execute build pipeline (if configuration present)
  test      Run Mocha and Solidity tests
  console   Run a console with contract abstractions and commands available
  create    Helper to create new contracts, migrations and tests
  install   Install a package from the Ethereum Package Registry
  publish   Publish a package to the Ethereum Package Registry
  networks  Show addresses for deployed contracts on each network
  watch     Watch filesystem for changes and rebuild the project automatically
  serve     Serve the build directory on localhost and watch for changes
  exec      Execute a JS module within this Truffle environment
  version   Show version number and exit

See more at http://truffleframework.com/docs


root@i-5tthrr8u:/home/ubuntu# npm install -g ethereumjs-testrpc
/usr/local/node-v8.1.2-linux-x64/bin/testrpc -> /usr/local/node-v8.1.2-linux-x64/lib/node_modules/ethereumjs-testrpc/build/cli.node.js

> fsevents@1.1.2 install /usr/local/node-v8.1.2-linux-x64/lib/node_modules/ethereumjs-testrpc/node_modules/fsevents
> node install


root@i-5tthrr8u:/home/ubuntu# testrpc
EthereumJS TestRPC v4.0.1 (ganache-core: 1.0.1)

Available Accounts
==================
(0) 0xddd46df3d28bacaed362d1d7174c2d0186cf4cce
(1) 0xe272b9a170a846e414289e7a24a7ad6657e20f8a
(2) 0xd82dbe75eb00b8b54fbfb86e7d0aca0f5f7eceda
(3) 0x32943f073348b4b0b1d549c30a6f5dd228903f5d
(4) 0x06ad753874df1c2eff023836fe0f2f4ed1cddb9a
(5) 0xe485e78034fa2be70a4393f7eea685ae3929c699
(6) 0x5f0fd66ce76b65a9cf0b184eb33b429538d6a791
(7) 0xcdba330a8dd67a833521a12b5b44bae413de5a76
(8) 0xc25d606651a124c0fb263810bc32e8fabf0ea3ea
(9) 0xb622020fccb38779aedbdcd87e41ac437ac886c9

Private Keys
==================
(0) 5c9ddc539ba842290425383c9136ad6f51deb3e07e935f23462f57d01cf29619
(1) 871f7657480c42d04be5eeed7954ad6f73c4a49c0fcc82f060d577239d21bc67
(2) 6438d2f0930fe25cf37295960f6ab01ab3939122b0150f7c0918bc76dd49a4ba
(3) d64725057ce517a7649408a77a53831ab6bd00e6184e0ca85e0f7b45e197ec23
(4) 4d67cfb83d49eefc46b1c0f1142f1bb87d7bd3f46e113f46dd92a5ce48bbe4ce
(5) 988b92e5c489ace50ffd630db4a6617e3eb939bb11bdfc2dd67d54aa1a05a5e7
(6) 041a305c406185a5439db9cf67698bf682a827720f0e95bf6fb2f97d56d176d2
(7) 071be375e8f59b8b6fce988b9fa22453c82ff1b5a12d66673e8bbbced0ecfaa2
(8) eba14df0e70e5ce618639920d1520a6d080b11ee8bfa0c597e87cec7a1aa7937
(9) 2108099baaa0ea01ac989253ccd5aed91caceff8310c809b4fda6b15e23b2ea8

HD Wallet
==================
Mnemonic:      grunt duty stumble slender race much lift exclude machine sock gallery security
Base HD Path:  m/44'/60'/0'/0/{account_index}

Listening on localhost:8545
^Croot@i-5tthrr8u:/home/ubuntu# 

3安装solc


root@i-5tthrr8u:/home/ubuntu# npm install -g solc
/usr/local/node-v8.1.2-linux-x64/bin/solcjs -> /usr/local/node-v8.1.2-linux-x64/lib/node_modules/solc/solcjs
+ solc@0.4.11
added 65 packages in 3.321s
root@i-5tthrr8u:/home/ubuntu# 


root@i-5tthrr8u:/home/ubuntu# npm install -g solc-cli
/usr/local/node-v8.1.2-linux-x64/bin/solc -> /usr/local/node-v8.1.2-linux-x64/lib/node_modules/solc-cli/dist/index.js
npm WARN solc-cli@0.3.0 requires a peer of solc@^0.3.5 but none was installed.

+ solc-cli@0.3.0
added 20 packages in 21.89s
root@i-5tthrr8u:/home/ubuntu# solcjs --help
Usage: solcjs [options] [input_file...]

Options:
  --version         Show version number                                [boolean]
  --optimize        Enable bytecode optimizer.                         [boolean]
  --bin             Binary of the contracts in hex.                    [boolean]
  --abi             ABI of the contracts.                              [boolean]
  --standard-json   Turn on Standard JSON Input / Output mode.         [boolean]
  --output-dir, -o  Output directory for the contracts.                 [string]
  --help            Show help                                          [boolean]
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值