web3j
web3j copied to clipboard
MessageDecodingException: Value must be in format 0x[1-9]+[0-9]* or 0x0
Hi,
i am getting gas price from val gasPrice = web3?.ethGasPrice()?.send()!!.gasPrice but when i get gas limit i got messagedecoding exception
Here my code:
val nonce = web3!!.ethGetTransactionCount(credentials!!.address, DefaultBlockParameterName.LATEST).send().transactionCount
val amount = depoAmount.toBigDecimal()
val function = Function("transfer", listOf(Address(receiveAddress), Uint256(amount.toBigInteger())), emptyList())
val txData: String = FunctionEncoder.encode(function)
val transaction = Transaction(credentials?.address,nonce, gasPrice, BigInteger.ZERO,tokencontractAddress,amount.toBigInteger(),txData)
val gasLimit = web3?.ethEstimateGas(transaction)!!.send().amountUsed
val gasProvider = StaticGasProvider(gasPrice, gasLimit)
please help me to solve this issue.. thanks
hello @AjithNoah , Have you found any solution for this?
- hello,you may input 0x2999 instead of 「0x0」