0

Why can't I send Ethereum with a code like this :

const Web3 = require('web3')

const provider = new Web3.providers.HttpProvider('https://provider')
const web3 = new Web3(provider)

const account = web3.eth.accounts.privateKeyToAccount('privkey is here')
let coinbase = account.address
web3.eth.accounts.wallet.add(account)
web3.eth.defaultAccount = coinbase

web3.eth.sendTransaction({ from: coinbase, gas: 200000000, to: 'address send', value: (1 * (10 * 18)) }).then((receipt) => { console.log(receipt); }).catch((error) => { console.error(error); });

At show log like this :

Error: Returned error: exceeds block gas limit

1

The gas limit for a block is around 8 million, but you tried to send a transaction with a gas limit of 200 million gas.

  • oh ok thanks for your response, I will try it. – Raka Widhi Antoro Oct 3 '19 at 13:30

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.