You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web3: 1.0.0-beta.30 and 1.0.0-beta.31
ethermint: 0.5.3-b72a1eef
go-ethereum: 1.6.7-stable
When sending a transaction, and setting the gasPrice to 0, the gasPrice is ignored and the default gas price is used instead. Other values (1, 2, 1000000, ...) work. This happens when deploying a contract (as shown below in the example code) and also when sending a transaction on an existing contract.
In web3 0.20.6, setting the gasPrice to 0 works fine.
Setting the gasPrice to 0 is useful for private, permissioned networks (e.g. ethermint).
Example code:
constsolc=require('solc');constEth=require('web3-eth');consteth=newEth(Eth.givenProvider||"http://localhost:8545");constinput=`contract A { uint public x; function A(uint _x) { x = x; }}`console.log("compiling...");constoutput=solc.compile(input);console.log("done");constcompiled=output.contracts[":A"];constcontract=neweth.Contract(JSON.parse(compiled.interface));letaccount;letdeploy;eth.personal.getAccounts().then(accounts=>{account=accounts[0];console.log("using account "+account)returneth.personal.unlockAccount(account,"1234")}).then(()=>{console.log("unlocked account. estimating gas...");deploy=contract.deploy({data: '0x'+compiled.bytecode,arguments: [123]});returndeploy.estimateGas({from: account})}).then(gasEstimate=>{console.log("gasEstimate = "+gasEstimate+", now deploying...");returndeploy.send({from: account,gas: gasEstimate,gasPrice: 0// <------------------------------------- this has no effect}).once('transactionHash',hash=>{console.log("transaction hash: "+hash);eth.getTransaction(hash).then(transaction=>console.log("gasPrice was: "+transaction.gasPrice));})}).then(()=>console.log("done")).catch(err=>console.log(err.stack))
Output:
compiling...
done
using account 0x7eFf122b94897EA5b0E2A9abf47B86337FAfebdC
unlocked account. estimating gas...
gasEstimate = 116392, now deploying...
hash: 0x247100d4d1bf75042fdf94a3744ce095a71060b4192b52161b9e761fbe348d68
gasPrice was: 18000000000
done
The text was updated successfully, but these errors were encountered:
web3: 1.0.0-beta.30 and 1.0.0-beta.31
ethermint: 0.5.3-b72a1eef
go-ethereum: 1.6.7-stable
When sending a transaction, and setting the gasPrice to 0, the gasPrice is ignored and the default gas price is used instead. Other values (1, 2, 1000000, ...) work. This happens when deploying a contract (as shown below in the example code) and also when sending a transaction on an existing contract.
In web3 0.20.6, setting the gasPrice to 0 works fine.
Setting the gasPrice to 0 is useful for private, permissioned networks (e.g. ethermint).
Example code:
Output:
The text was updated successfully, but these errors were encountered: