Sort:  
Loading...

ganache本质是一个使用javascript实现的以太坊客户端。
缺点:只存在于内存,一重启数据全没!

cnpm install ganache-cli -g
ganache-cli

配置truffle:
module.exports = {
  networks: {
    ganachenet: {
      host:"127.0.0.1",
      port:8545,
      network_id:"*"
    }
  }
};

truffle compile
truffle migrate --network ganachenet  //布署到指定网络

cnpm install -g truffle
truffle version
truffle --help

npm uninstall -g truffle //卸载

truffle init  初始化,生成以下文件
    contract migrations test turffle-config.js truffle.js
truffle develop  启动编译环境
    web3.eth.coinbase;   //第0个帐户
    web3.eth.account[1]; //第1个帐户
    web3.eth.getBalance("addr")   //查询余额
    //eth = 100*10**18 wei, 后面18个零
    //acount = web3.toWei(30, "ether");
    web3.eth.sendTransaction({from:"0x3a...c35c", to:"0x6f...04", value:20000}); //转帐
truffle console --network ganachenet  //交互
truffle compile  //编译
truffle migrate --network ganachenet  //布署到指定网络
   migrations -> 2_initial_helloworld.js
Loading...
Loading...
Loading...

在geth私有节点的基础上,另起一个节点,使用同样的创世区块设置。

  1. 新建目录:private2
  2. init.json //创世区块要一致
  3. geth init init.json --datadir .
  4. geth --datadir . --port 30302 --nodiscover --ipcdisable console
  5. net.peerCount //查看相连的节点
    admin.nodeInfo.enode //查看节点信息
    "enode://[email protected]:30302?discport=0"
Loading...

Coin Marketplace

STEEM 0.25
TRX 0.11
JST 0.032
BTC 63519.79
ETH 3073.58
USDT 1.00
SBD 3.82