I want to store a document hash on an Ethereum network. I have two options. 1st one is to send the transaction directly through a node js application with input field as the document hash ie,
const txObject = {
nonce: web3.utils.toHex(count),
to: toAccount,
gasLimit: web3.utils.toHex(estimatedGas),
gasPrice: web3.utils.toHex(web3.utils.toWei('9', 'gwei')),
data: web3.utils.toHex(message)
}`
2nd way is to send it by smart contract:
function notarizeHash(uint256 id, bytes32 documentHash) public onlyOwner noHashExistsYet(id) {
hashesById[id] = documentHash;
I want to find how much is the gas difference. How can I find the gas required of function notarizeHash without actually deploying it in the main net?
await transaction.estimateGas(...), withtransactioninitialized ascontract.methods.notarizeHash(...). Have you bothered to read that answer at all??? – goodvibration Jun 11 '20 at 06:38