gpt4 book ai didi

ethereum - 无法运行 truffle@2.1.2 migrate --network live。 "Exceeds block gas limit"

转载 作者:行者123 更新时间:2023-12-02 19:21:34 26 4
gpt4 key购买 nike

我正在使用 truffle@2.1.2 针对 localhost:8545 geth@1.5.9-stable rpc 部署智能合约,使用的账户资金来源为以太币已在 geth 控制台上使用 personal.unlockAccount 解锁。

我还通过 RPC 对远程 Parity 节点进行了相同的尝试,但这是我相当坚持的最新版本。

truffle.js

module.exports = {
build: {
"index.html": "index.html",
"app.js": [
"javascripts/app.js"
],
"app.css": [
"stylesheets/app.css"
],
"images/": "images/"
},
rpc: {
host: "localhost",
port: 8545
},
networks: {
"ropsten": {
network_id: 3,
port: 8548, // ssh tunnelled to AWS geth/parity node localhost:8545
from: "0x4f000Bcf4641E2fDcE85BF26A694b053996850D4"
},
"live": {
network_id: 1,
port: 8545,
from: "0x00269400181f1B379784BD8cDF786bb20e91Bdef",
gas: 4612388,
gasPrice: 2776297000 // taken from Parity startup log message "Updated conversion rate to Ξ1 = US$42.88 (2776297000 wei/gas)"
}
}
};

truffle migrate --network live

Running migration: 1_initial_migration.js
Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Exceeds block gas limit
at Object.module.exports.InvalidResponse (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
at /home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
at request.onreadystatechange (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
at dispatchEvent (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
at setState (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
at IncomingMessage.<anonymous> (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:926:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)

我尝试调整gas和gasPrice,但找不到有任何影响的值。

我该如何解决这个问题,或者我应该考虑其他契约(Contract)部署方法吗?

亲切的问候。

最佳答案

我只需在网络配置中设置 gas: 3000000 即可解决此问题。

"live": {
network_id: 1,
port: 8545,
from: "0x00269400181f1B379784BD8cDF786bb20e91Bdef",
gas: 3000000
}

运行迁移大约需要 0.5 ETH,并且需要几分钟时间。

关于ethereum - 无法运行 truffle@2.1.2 migrate --network live。 "Exceeds block gas limit",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42924634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com