Ethereum Geth eth.sendTransaction不工作
我正在学习以太坊,并尝试了geth1.7.3-stable的私有网络 帐户[0]在专用网络中有105个eth,我尝试发送eth,如下所示 但是eth.sendTransaction命令只返回 “0xaf571929f95ddeaab8761d719dba3c852f5d4f9895968a905c275561eaf57ae6” 账户[1]没有收到任何ethEthereum Geth eth.sendTransaction不工作,ethereum,geth,Ethereum,Geth,我正在学习以太坊,并尝试了geth1.7.3-stable的私有网络 帐户[0]在专用网络中有105个eth,我尝试发送eth,如下所示 但是eth.sendTransaction命令只返回 “0xaf571929f95ddeaab8761d719dba3c852f5d4f9895968a905c275561eaf57ae6” 账户[1]没有收到任何eth > eth.getBalance(eth.accounts[0]) 105000000000000000000 > person
> eth.getBalance(eth.accounts[0])
105000000000000000000
> personal.unlockAccount(eth.accounts[0])
Unlock account 0x24636f1423f131f5441fbee83323c53c59af247d
Passphrase:
true
> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(2, 'ether')})
"0xaf571929f95ddeaab8761d719dba3c852f5d4f9895968a905c275561eaf57ae6"
>
> eth.getBalance(eth.accounts[1])
0
有人知道如何解决这个问题吗?首先,检查并确保交易到达您的区块链。使用
web3.eth.filter("pending").watch(
function(error,result){
if (!error) {
console.log('Tx Hash: ' + result);
}
}
)
设置侦听器后,再次运行sendTransaction
,并确认您收到了日志语句。如果是这样,则表示您正确提交了事务
正如评论中提到的,下一件事是确保挖掘事务。有几种方法可以做到这一点:
geth attach
连接到它。在geth控制台中,可以使用miner.start()
开始挖掘。它将返回null,但您应该在geth输出中看到活动,指示挖掘已经开始。要停止挖掘,请键入miner.stop()
geth
仍在运行时启动它应该提取任何挂起的事务。根据您的描述,您似乎正在运行节点(常量函数返回正确),但没有挖掘任何事务。是的,我创建了genesis文件并创建了private net。我以前尝试过
开始挖掘
,但返回null。这是原因吗?接下来我该怎么办?我意识到我错了。采矿以前实际上并没有开始。现在我得到了正确的结果。但是miner.start()
仍然响应null。