千家信息网

Ethereum相关命令怎么使用

发表于:2025-02-04 作者:千家信息网编辑
千家信息网最后更新 2025年02月04日,本篇内容主要讲解"Ethereum相关命令怎么使用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Ethereum相关命令怎么使用"吧!一、struct C
千家信息网最后更新 2025年02月04日Ethereum相关命令怎么使用

本篇内容主要讲解"Ethereum相关命令怎么使用",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Ethereum相关命令怎么使用"吧!

一、struct ConfirmOrder中定义一个mapping(uint=>ConfirmDetail) confirmDetails,则创建ConfirmOrder时,confirmDetails可以不赋值。如果使用ConfirmDetail[] confirmDetails时,创建ConfirmOrder时,不赋值,则报错:TypeError: Wrong argument count for struct constructor: 5 arguments given but expected 6.

二、function AddConfirmDetails(uint _orderId,string _state) public view returns(uint amount){,这样写无法显示这个方法。function AddConfirmDetails(uint _orderId,string _state) public{,这样写就能显示这个方法。

三、public view returns,加view时,就无法插入,不加view能插入但无法返回值

四、查询geth版本

$ geth version

Geth

Version: 1.8.3-stable

Architecture: amd64

Protocol Versions: [63 62]

Network Id: 1

Go Version: go1.10.1

Operating System: darwin

GOPATH=

GOROOT=/usr/local/opt/go/libexec

五、查询go版本

$ go version

go version go1.10.1 darwin/amd64

六、区块链命令

txpool.status

miner.start(1);admin.sleepBlocks(5);miner.stop();

eth.getBlock(33)

web3.fromWei(eth.getBalance(eth.accounts[0]),'ether')

admin.peers

$ geth --testnet --fast console 2>> geth-test.log 测试网络

$ geth --fast console 2>> geth-test.log 主网络

> eth.syncing 查询同步进度

遇到问题:synchronisation failed retrying block download canceled使用下面两句话后继续执行上面的语句同步节点

$ geth removedb

$ geth upgradedb

七、多节点私有链启动命令必须一致,否则一个节点提交区块,其他节点无法挖矿处理此区块。

比如

$ geth --identity "itari" --datadir data0 --networkid 899 --port 30303 --rpc --rpcaddr localhost --rpcport 8545 --rpcapi "db,web3,eth,personal,miner,net,txpool" --rpccorsdomain "*" console 2>> data.log

$ geth --identity "itari" --datadir data0 --networkid 899 --port 30303 --rpc --rpcaddr localhost --rpcport 8545 console

两种不同的启动方式

到此,相信大家对"Ethereum相关命令怎么使用"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

0