yum install golang
yum install git
安装go-ethereum:
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum
make geth
make all
修改环境变量:export PATH=/home/soft/go-ethereum/build/bin:$PATH
安装node
(1)下载node源码:https://nodejs.org/en/download/ 上传服务器
(2)解压:tar -xf node-v9.3.0.tar.gz
(3)安装:
cd node
./configure
make && make install
(4)测试:node -v npm -v
安装truffle:npm install -g truffle
创建项目:mkdir pet-shop-tutorial
cd pet-shop-tutorial
truffle unbox pet-shop
初始化私有链:geth --datadir=./chaindata/ init ./genesis.json
启动私有链:geth --datadir=./chaindata console
查看节点信息:admin.nodeInfo.enode
添加节点:admin.addPeer()*注意里面的ip要换掉
查看添加的节点信息:admin.peers
查询账户:web3.eth.accounts
添加账户:web3.personal.newAccount("123456")
查询余额:web3.eth.getBalance("0xbe323cc4fde114269a9513a27d3e985f82b9e25d") /eth.getBalance(eth.coinbase)
解锁账户:web3.personal.unlockAccount(acc0,"123456")
交易:web3.eth.sendTransaction({from:acc0,to:acc1,value:web3.toWei(3,"ether")})
开始挖矿:miner.start()
停止挖矿:miner.stop()