Hi I am working on private ethereum product, I struct in web3 eth transfer api Plz anyone guide me

Mar 16, 2021, 5:27 PM
router.post('/transferEther', async (req, res) => {
//console.log("############################"+JSON.stringify(req.body));
try {
web3.eth.sendTransaction({
from: req.body.from,
to: req.body.to,
value: web3.utils.toWei('1', 'ether')
}, function(err, transactionHash) {
if (err) {
console.log(err);
} else {
console.log(transactionHash);
}
});


} catch (fresult)
{
console.log("elsecondition:" + fresult);
res.status(404).send({message: "could not able to transaction.", "status": false, error: fresult})
}
});
Mar 16, 2021, 5:31 PM

© 2024 Draquery.com All rights reserved.