英文:
transaction underpriced error occured whever i tried to run the below code
问题
const tx = {
nonce: 5,
gasPrice: 20000000000,
gasLimit: 1000000,
to: null,
value: 0,
data: "0x608060405234801561001057600",
chainId: 1337,
};
// const signedTxResponse = await wallet.signTransaction(tx);
const sentTxResponse = await wallet.sendTransaction(tx);
// await sentTxResponse.wait(1);
console.log("sentTxResponse", sentTxResponse);
上述代码中出现了一个错误,它给出了一个"transaction underpriced"错误,错误信息为:"error: could not coalesce error"。我已经尝试过更改了gas限制和gas价格。
请注意,我只翻译了代码部分,没有包括您提供的错误信息。如果您需要有关错误信息的翻译或其他帮助,请提供详细信息。
英文:
const tx = {
nonce: 5,
gasPrice: 20000000000,
gasLimit: 1000000,
to: null,
value: 0,
data: "0x608060405234801561001057600",
chainId: 1337,
};
// const signedTxResponse = await wallet.signTransaction(tx);
const sentTxResponse = await wallet.sendTransaction(tx);
// await sentTxResponse.wait(1);
console.log("sentTxResponse", sentTxResponse);
i have an error for the above code its give me an transaction underpriced error error: could not coalesce error
(error={ "code": -32003, "message": "transaction underpriced", "stack": "Error: transaction underpriced\\n at shouldReplace (/tmp/.mount_ganach8fQ6uV/resources/static/node/node_modules/ganache/dist/node/1.js:2:119740)\\n at TransactionPool.prepareTransaction (/tmp/.mount_ganach8fQ6uV/resources/static/node/node_modules/ganache/dist/node/1.js:2:122311)" }, code=UNKNOWN_ERROR, version=6.4.0)
i tried to change the gas limit and gas price
答案1
得分: 0
const nonce = await wallet.getNonce();
const tx = {
nonce: nonce,
gasPrice: 20000000000,
gasLimit: 1000000,
to: null,
value: 0,
data: "0x608060405234801561001057600",
chainId: 1337,
};
// const signedTxResponse = await wallet.signTransaction(tx);
const sentTxResponse = await wallet.sendTransaction(tx);
// await sentTxResponse.wait(1);
console.log("sentTxResponse", sentTxResponse);
英文:
const nonce = await wallet.getNonce()
const tx = {
nonce: nonce,
gasPrice: 20000000000,
gasLimit: 1000000,
to: null,
value: 0,
data: "0x608060405234801561001057600",
chainId: 1337,
};
// const signedTxResponse = await wallet.signTransaction(tx);
const sentTxResponse = await wallet.sendTransaction(tx);
// await sentTxResponse.wait(1);
console.log("sentTxResponse", sentTxResponse);
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论