区块链1

# 本人windows 系统
# 安装 git bash
# 安装 nodejs
# 安装后重启 git bash
# 确认windows 中 nodejs 安装成功

win@2554n-PC MINGW64 ~
$ npm -v
5.6.0

win@2554n-PC MINGW64 ~
$ node -v
v8.11.1

# 安装 ganache-cli
# 图形化见: https://github.com/trufflesuite/ganache/releases/download/v1.1.0/ganache-setup-1.1.0.exe

# 非图形化如下
win@2554n-PC MINGW64 ~
$ npm install -g ganache-cli
npm WARN deprecated babel-preset-es2015@6.24.1: ?  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
C:\Users\win\AppData\Roaming\npm\ganache-cli -> C:\Users\win\AppData\Roaming\npm\node_modules\ganache-cli\build\cli.node.js
npm WARN webpack-cli@2.1.3 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

+ ganache-cli@6.1.0
added 632 packages in 58.269s

# 启动
win@2554n-PC MINGW64 ~
$ ganache-cli
Ganache CLI v6.1.0 (ganache-core: 2.1.0)

Available Accounts
==================
(0) 0x8917b3ad479d9f4a4b3dd394e3f42204c99b179c
(1) 0xf3d30e136f33ea7d622aae0a576a2746a00fd7e2
(2) 0xb467d37168437e03b6d227324e44d2aa33653e1b
(3) 0xfba93870a1791d4fb51734831930c706b535fd43
(4) 0xe0811a50c38567ec7bf3ffda944b61fcc5c0f833
(5) 0x487cce1a50cd18328f5699e65cd80620350ec5c5
(6) 0xe5de74a283c0aa9009ca916fe1e399707d4480f6
(7) 0xad53fe23689d480e527ca9fa7082338c5b97991e
(8) 0x87f2f096c98335c32976f031e6d615deb05c8d50
(9) 0x0414348bf5482a9f16483931ac4dd6faf65d37e4

Private Keys
==================
(0) 48add3aa9524496cf39c257f578d8147a7f897eeadda40a4c2f984995e787d2e
(1) 9771a45d535f275decac13598d85fc2f80ae6abc8b3d78a733a63feb957a77a2
(2) 8b50cda233b62b8ce6edbdc7bfb4ac99a4189b6e205bf72ce067e2791c0137f0
(3) 677e463825bee974dc577fc4d46777629cd25a73edae9c8fdcceb46d19f775fa
(4) 13d65be2fdcfb181296c5587332ed8ccef13690a2bc30c781cafd8de9678d3c3
(5) da5536ceadf89e3066c76886fc52d507a98233231c0271d996123f3c1c3ede5c
(6) 1f3e8f91538e277b43e06989572e6c40d4a25e1a4dc45720be52f8749a46c875
(7) 5b69561f29223b826b40d0aedadad4c224d0ab8d4268ffe76b5c7ae6d0fe1c5d
(8) bdecc00e0d8edfb88d03387686e7eac550e864f9de193070f74e3e930b132de5
(9) a75b6f24c847b2dbed52a64cdd8870484953718fdbb31bd078bc600c0d3d1e10

HD Wallet
==================
Mnemonic:      armed predict symptom dwarf focus tape dance turtle okay garment                                                                                                                                                                                                bird van
Base HD Path:  m/44'/60'/0'/0/{account_index}

Listening on localhost:8545

# 安装 truffle,truffle 是 以太坊开发框架
win@2554n-PC MINGW64 ~
$ npm install -g truffle
C:\Users\win\AppData\Roaming\npm\truffle -> C:\Users\win\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js
+ truffle@4.1.8
added 92 packages in 15.303s

# 查看版本号,确认是否安装成功
win@2554n-PC MINGW64 ~
$ truffle -v
Truffle v4.1.8 - a development framework for Ethereum

Usage: truffle <command> [options]

Commands:
  init      Initialize new and empty Ethereum project
  compile   Compile contract source files
  migrate   Run migrations to deploy contracts
  deploy    (alias for migrate)
  build     Execute build pipeline (if configuration present)
  test      Run JavaScript and Solidity tests
  debug     Interactively debug any transaction on the blockchain (experimental)
  opcode    Print the compiled opcodes for a given contract
  console   Run a console with contract abstractions and commands available
  develop   Open a console with a local development blockchain
  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
  unbox     Download a Truffle Box, a pre-built Truffle project
  version   Show version number and exit

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

# 准备创建项目
win@2554n-PC MINGW64 ~
$ cd /f/

win@2554n-PC MINGW64 /f
$ mkdir test_ytf

win@2554n-PC MINGW64 /f
$ cd test_ytf/

# 初始化 truffle 
win@2554n-PC MINGW64 /f/test_ytf
$ truffle init
Downloading...
Unpacking...
Setting up...
Unbox successful. Sweet!

Commands:

  Compile:        truffle compile
  Migrate:        truffle migrate
  Test contracts: truffle test

# vscode 的settings
{
    "editor.detectIndentation": false,
"solidity.linter":"solhint",
"solidity.solhintRules":{
    "avoid-sha3":"warn"
},
"editor.fontSize": 20,

"workbench.colorTheme": "Visual Studio Light"
}

转载于:https://my.oschina.net/corleone/blog/1808633

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值