web3.eth.sendTransaction is giving VM exception error on test network (localhost)

gsmunagalagsmunagala Member Posts: 1
Hello all,

I am facing below issue while sending ether from one wallet address to another on local host.
interestingly if I send 1Ether, no issue
but if send other than 1 Ether, i get VM exception
not sure what is happening

any help would be appreciated. Please see below my javascript code:


$("#btn5").click(function() {
//read amount to transfer
var amt = document.getElementById("amt");
console.log(amt.value);
if (amt.value) {
$(()=>{

if (typeof web3 != 'undefined') {
web3.eth.sendTransaction({
to: '0x80a255a6e982993d8b745ca2c6c8d8a71a00ab48',
value: web3.toWei(amt.value, 'ether')
}, (err, data) => {
if (err) {
console.log("donation failed");
console.log(err);
console.log(data);
} else {
console.log("donation successful");
var bal1 = web3.eth.getBalance("0x80a255a6e982993d8b745ca2c6c8d8a71a00ab48");
console.log(bal1);
document.getElementById('jamt').value = bal1.toNumber();
}
})
}
})
}
})

Sign In or Register to comment.