- 我通过 JavaScript 发送交易
- Metamask 打开传输对话框
- 我确定
我在元掩码中收到错误消息
(inpage.js:1 MetaMask - RPC 错误:错误:错误:[ethjs-rpc] 有效负载的 rpc 错误 {"id":3801695059583,"jsonrpc":"2.0","params":["0xf8ac098504a817c80082753094bd212f85764be5ecdb5d0ca44ed46ac8 66b352c781c8b844d0679d3400000000000000000000000058f9015d8b36eacbd4d105cb79872992c073583f000000000000000000000000000000000000 0000000000000000000000000000822d45a028d2355a1149fac93070742fc4e14213f441d4a8dfd97611b4de238f1ef70ffaa048f0eed65a9c495ce42229d569d1 56a7ff4cc206efced1f25e1c779c53f24485“],” method":"eth_sendRawTransaction"} 错误:处理事务时出现 VM 异常:恢复)
我在 Metamask 设置中重置了帐户的交易历史记录。
**有关我的 html 中的帐户的信息 **
硬币:(obj / adr / data):[对象对象] / 0xBd212f85764Be5ecDB5d0ca44ed46AC866B352c7 /未定义
CoinContract: (obj/adr/data):[对象对象]/未定义/未定义
硬币制造者:0x6d8c98f8eb01f8f7ee55d25bf01e30fa64333940
硬币 erzeugen Account1 0x6d8C98f8eb01F8f7ee55D25Bf01e30Fa64333940 Saldo1 65764158165999998600 金额:0.37
硬币发送 Account2 0x58f9015d8B36EAcBD4d105CB79872992C073583F Saldo2 30997031680000000000 金额:0.37
硬币发送 Account3 0xBd212f85764Be5ecDB5d0ca44ed46AC866B352c7 Saldo3 0 金额:0.37
从container.js调用事务
function CoinSenden (data,adressat) {
console.log("Coin senden: " + adressat);
try {
//
// Code für ändern ????
//
var param1=data.amount;
var myContract = web3.eth.contract(CoinABI);
var myContractInstance = myContract.at(CoinContractADR);
console.log("contract/contractinstanz:" + myContract + "/" + myContractInstance);
console.log("contract/contractinstanz:" + myContract.address + "/" + myContractInstance.address);
console.log("para:" + param1 + "/" + "adr:" + ContainerAccount2);
myContractInstance.send(
ContainerAccount2,param1,
{from : ContainerAccount2, value: 200, gas: 30000, gasPriceInWei : 1000},
function(err, myContract){
if(!err) {
// NOTE: The callback will fire twice!
// Once the contract has the transactionHash property set and once its deployed on an address.
// e.g. check tx hash on the first call (transaction send)
if(!myContract.address) {
console.log("Phase1- " + myContract.transactionHash) // The hash of the transaction, which deploys the contract
// check address on the second call (contract deployed)
} else {
console.log("Phase2- " + myContract.address) // the contract address
}
// Note that the returned "myContractReturned" === "myContract",
// so the returned "myContractReturned" object will also get the address set.
}
else {
console.log("Fehler in der Methode beim Coin senden: " + err);
}
});
console.log("Coin senden fertig.")
} catch (err) {
console.log("Fehler beim Coin senden: " + err);
}
}
嗯,不过分。我想看看它是否有效:
- ganache 中已提交的交易
- 账户的新余额
Yeah I also had the same issue. But the answer for me was really simple. I just needed to clear the transaction history in Metamask. Settings -> Reset Account. . The reason is because Metamask saves state internally that tracks the nonce of the local blockchain. When you reset your local blockchain, but don't reset Metamask, then it gets confused, and thinks it's trying to send a transaction for a block in the past. But resetting the account clears out that history, and so you're good to go. It doesn't change balances, so it's super fast and easy.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)