簡體   English   中英

錯誤:部署到 rinkeby 時交易定價過低

[英]Error: transaction underpriced while deploying to rinkeby

下面的代碼在控制台中的“嘗試從帳戶部署:..”行停止工作,一段時間后它給出“Trnsaction 未在 750 秒內被挖掘,請確保您的交易已正確發送”,早些時候它給出了錯誤“交易定價過低”,我嘗試添加 gasPrice 並提高 gas 價格,但仍然得到相同的結果。 誰能幫我嗎?

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