Thrown: ReferenceError: eth is not defined
エラー
Ganacheを使って開発を行なっていて
コンソール操作で以下のようなエラーが出てきました
truffle(development)> eth.blockNumber
Thrown:
ReferenceError: eth is not defined
対処法
eth
の前にweb3
をつけたら解決しました
truffle(development)> web3.eth.blockNumber
28
eth
は複数ある場合には全てのeth
の前にweb3
をつけたら解決しました。
truffle(development)> eth.sendTransaction({from: eth.accounts[1], to:eth.accounts[0], value: web3.toWei(50, 'ether')})
Thrown:
ReferenceError: eth is not defined
truffle(development)> web3.eth.sendTransaction({from: web3.eth.accounts[1], to: web3.eth.accounts[0], value:web3.toWei(5, "ether")})
'0x328b1ff0f901d3e7ca929ae6ad83d5eb82246c5f9ff834288a764aaa125e0493'
問題点
ただeth
以外には応用が利きませんでした。
truffle(development)> miner.stop()
Thrown:
ReferenceError: miner is not defined
truffle(development)> web3.miner.stop()
Thrown:
TypeError: Cannot read property 'stop' of undefined
解決法がありましたら教えていただけると幸いです。
Author And Source
この問題について(Thrown: ReferenceError: eth is not defined), 我々は、より多くの情報をここで見つけました https://qiita.com/ywzx/items/c4e58ea1a7c2ed99b3ae著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .