下载GETH工具GETH - 窗口amd64-1.8.3-329ac18e.exe,并安装
Geth字段:--- nonce(从0开始增长,每产生一个transaction就增加1)
启动:
geth --datadir D:/ server / ethereum-data --rpc --rpcapi“db,eth,net,web3,miner,personal”console --rpcport 8090 --port 30303 --identity“Huangyuanteng”--networkid 1771 |
启动参数:
--rpcport 8090 - 端口 --port 30303网络监听端口,用来和其他节点手动连接 - 身份“yooliee”用来标识你的节点的,方便在一大群节点中识别出自己的节点 --networkid 1990你自己的私有网络的id号 --ipcdisable多个节点IPC端点是唯一的或IPC接口被禁用 --nodiscover不被发现 |
JavaScript的环境的交互窗口
geth attach --datadir“/ opt / blockchains / ethereum / data” |
连接到测试网络:
geth --datadir D:/ server / ethereum-data2 --nodiscover --syncmode fast --rinkeby console |
常用命令:
eth.accounts - 查看此节点下的所有账户 th.blockNumeber - 查看块高 eth.coinbase - 查看矿工地址 miner.setEtherbase(“”) - 设置矿工地址 personal.newAccount(“111111”) - 创建账户 personal.newAccount() - 创建账户 eth.getBalance(“0xbe2f1213da9807e9d64e8ae607be1c86bd53c210”) - 查看账户余额 eth.sendTransaction({from:“0x7d1f7be4112ce63b9de04a0bf95c1e87e430bd1b”,to:“0x587e57a516730381958f86703b1f8e970ff445d9”,value:web3.toWei(1,“ether”)}) - 转账 personal.unlockAccount(“0x7d1f7be4112ce63b9de04a0bf95c1e87e430bd1b”,“111111”) - 解锁账号(默认解锁时间为300 秒) miner.start() - 挖矿 miner.stop() - 停止挖矿
net.peerCount - 查看当前节点所链接的其他节点数 eth.syncing - 同步情况 eth.sign(“0xadce6e0e1ee491e7c1945e76d3dc5975418c4e45”,web3.sha3(“abc”)) - 对交易或数据进行签名操作 eth.sendRawTransaction(“0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675”) - 广播已经签名的交易信息 eth.getBlock(1) - 根据区块编号或区块哈希值查询区块信息 eth.getTransaction - 根据交易哈希查询交易信息 admin.nodeInfo - 查看节点 net.peerCount - 查看链接的节点 admin.peers - 查看链接的节点 |
输入ETH。,然后连着敲击两下标签键接口展示此角色的所有操作命令
dev模式启动,在命令行后面加-dev(dev 默认模式开启挖矿)
geth --datadir D:/ server / ethereum-data --rpc --rpcapi“db,eth,net,web3,miner,personal”console -dev --dev.period 1 |
示例:
> user1 = eth.accounts [0] “0x54624a6fa8515aad106b67c9cf487973729f8339” > user2 = eth.accounts [1] “0xc2151c350ee88dd221c25392a38f64859296ced5” > user3 = eth.accounts [2] “0x534926673de47af2dc76b8e07d6b77a3ee0a4ec9” > eth.sendTransaction({from:user1,to:user3,value:web3.toWei(0.00000003,“ether”)}) INFO [08-14 | 15:19:42]提交的事务fullhash = 0x29fec73cf446e0b23588433353a62930343dceed4b38ae92e2cd9d0025c9d706 recipient = 0x534926673De47AF2DC76B8e07d6b77A3EE0A4ec9 I“N0FxO2 9fe [c0783-c1f44 | 4165e:01b92:34528] 8 4C3o3m3m5i3ta 6n2e9w3 0m3i4n3idncge ewdo4rbk3 8 ae 9 2 e 2 cd 9 d 0 0 2 5 c 9 d 7n0u6m”be r> = 75 txs = 1 uncles = 0 elapsed = 1.035ms INFO [08-14 | 15:19:42]成功密封了新的块号= 75 hash = 1a5e33 ... 0a2fd0 INFO [08-14 | 15:19:42] |