Sendtransaction In Ethereum Platform

[Solved] Sendtransaction In Ethereum Platform | Solidity - Code Explorer | yomemimo.com
Question : sendTransaction in Ethereum Platform

Answered by : important-iguana-mi3cn0v9xfm4

// compiled solidity source code using https://remix.ethereum.org
var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3";
// using the callback
web3.eth.sendTransaction({ from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe', data: code // deploying a contract
}, function(error, hash){ ...
});
// using the promise
web3.eth.sendTransaction({ from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe', to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', value: '1000000000000000'
})
.then(function(receipt){ ...
});
// using the event emitter
web3.eth.sendTransaction({ from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe', to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe', value: '1000000000000000'
})
.on('transactionHash', function(hash){ ...
})
.on('receipt', function(receipt){ ...
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.on('error', console.error); // If a out of gas error, the second parameter is the receipt.

Source : https://web3js.readthedocs.io/en/v1.5.2/web3-eth.html#sendtransaction | Last Update : Wed, 19 Jan 22

Answers related to sendtransaction in ethereum platform

Code Explorer Popular Question For Solidity