传输ether时的Solidity事务错误

时间:2018-03-28 07:42:46

标签: solidity truffle

env:mac,truffle,ganache

有没有人可以告诉我为什么我不能将以太网从一个帐户转移到另一个帐户?下面是测试代码和调试信息。

truffle(develop)> web3.eth.getBalance(web3.eth.accounts[2])
{ [String: '80999999999999440773'] s: 1, e: 19, c: [ 809999, 99999999440773 ] }

truffle(develop)> web3.eth.getBalance(web3.eth.accounts[4])

{ [String: '98999999999999979000'] s: 1, e: 19, c: [ 989999, 99999999979000 ] }

truffle(develop)> web3.eth.sendTransaction({from: web3.eth.accounts[4], to: web3.eth.accounts[2], value: web3.toWei(1, "ether")})

'0xc56c7982006ed5bd9f47523c5f38e3e86185b389a02b7e7c4d23b1e33bd07224'

truffle(develop)> debug 0xc56c7982006ed5bd9f47523c5f38e3e86185b389a02b7e7c4d23b1e33bd07224

Gathering transaction data...

Addresses affected:
 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef(UNKNOWN)

Warning: The source code for one or more contracts could not be found.

Commands:
(enter) last command entered (step next)
(o) step over, (i) step into, (u) step out, (n) step next
(;) step instruction, (p) print instruction, (h) print this help, (q) quit
(b) toggle breakpoint, (c) continue until breakpoint
(+) add watch expression (`+:<expr>`), (-) remove watch expression (-:<expr>)
(?) list existing watch expressions
(v) print variables and values, (:) evaluate expression - see `v`


?:
(node:10530) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): TypeError: Cannot read property 'gasCost' of undefined

1 个答案:

答案 0 :(得分:0)

调试器用于逐步完成智能合约。你只是在两个地址之间进行简单的以太传输。如果您在完成转帐后输出帐户余额,则会看到转帐成功。