const params = {
to: '0xdbC0d76Fb1f2399b618FB29922dBC5cf763dd3d7',
from: dbDeposit.depositAddress,
value: balance,
gas: 2000000,
gasPrice: '234567897654321',
nonce: 0
};
console.log(params);
return web3.eth.signTransaction(params, myPrivateKey);
That's my code and I'm actually unsure as to how much gas
and gasPrice
to set. I understand that gasPrice
is sort of an upper limit and gas
is how much miners get to keep?
So how do I go about figuring out how much of each?
Best Answer
The amount you will pay for a transaction is gasPrice*gas, so gasPrice is exactly what the name indicates, is the price per 1 gas. The gas is a measure of how much computational work your transaction requires. You can omit these values and let the node select them if you do not know how to set it. The current gas price is 9000000000 yours is several orders of magnitude bigger.
Hope this helps,