Based on web3js 1.0

value - Number|String|BN|BigNumber
gas - Number
gasPrice - Number|String|BN|BigNumber

Does gasPrice and value accept both number and hexadecimal value and will do the conversion automatically? And what is the correct unit for value, gas and gasPrice. All in wei?

  • Show your code, so that we will have something to refer to. – goodvibration May 7 '18 at 5:49

As per Ethereum,

Gas is a unit or number of steps to be execute for your contract. Gas has fixed number of units for a specific operation/computation, this is fixed by Ethereum community. For example to add two numbers EVM consumes it may consumes 3 gas units.

VALUE field - The amount of wei to transfer from the sender to the recipient,

GASPRICE value, representing the fee the sender is willing to pay for gas. One unit of gas corresponds to the execution of one atomic instruction, Gasprice will in wei. Wei is a smallest unit.

  • The OP wants to know the acceptable number format(s), e.g. decimal, hex, big number, something else. – Rob Hitchens Oct 9 '18 at 0:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.