简体   繁体   English

错误:部署到 rinkeby 时交易定价过低

[英]Error: transaction underpriced while deploying to rinkeby

The below code just stops working at the line "Attempting to deploy from account: .." in console and after sometime it gives "Trnsaction was not mined within 750s, please make sure your transaction was sent properly", Earlier it was giving the error "transaction underpriced", I tried adding gasPrice and increasing the gas price but still got the same result.下面的代码在控制台中的“尝试从帐户部署:..”行停止工作,一段时间后它给出“Trnsaction 未在 750 秒内被挖掘,请确保您的交易已正确发送”,早些时候它给出了错误“交易定价过低”,我尝试添加 gasPrice 并提高 gas 价格,但仍然得到相同的结果。 can anyone help me out?谁能帮我吗?

const hdWalletProvider = require('@truffle/hdwallet-provider')
const Web3 = require('web3')
const { interface, bytecode } = require('./compile')

const provider = new hdWalletProvider(
  'fee brass payment tiny edge spoon control trophy provide rather harbor course',
  'https://rinkeby.infura.io/v3/53ed6ca9c43446a98fb1f9f799d2ca8f'
)

const web3 = new Web3(provider)

const deploy = async () => {
  const accounts = await web3.eth.getAccounts()

  console.log('Attempting to deploy from account:' + accounts[0])

  const result = await new web3.eth.Contract(JSON.parse(interface))
    .deploy({
      data: bytecode,
      arguments: ['hello there!'],
    })
    .send({ gas: '1000000', from: accounts[0] })

  console.log('Contract deployed to:' + result.options.address)
  provider.engine.stop()
}
deploy()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM