[英]Error when migrating contracts using truffle
使用 traffle 部署合約時,會出現以下錯誤:
"Migrations" -- Unable to decode sender address from transaction:
Incompatible EIP155-based V 38 and chain id 3.
See the Common parameter of the Transaction constructor to set the chain id....
我truffle-config.js
是這樣的:
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 9545, // Standard Ethereum port (default: none)
//gas: 8e6,
//gasPrice: 20,
network_id: "5777", // Any network (default: none)
},
ropsten: {
provider: () => new HDWalletProvider({
privateKeys: [testnetPrivateKey],
providerOrUrl: `https://eth-ropsten.alchemyapi.io/v2/${ropstenAlchemyApiKey}`
}),
network_id: 3, // Ropsten's id
networkCheckTimeout: 1000000000,
gas: 4000000,
confirmations: 1, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 50000, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
},
這些錯誤是什么意思,我應該如何配置以防止該故障? 謝謝!
構造 HDWalletProvider 時通過chainId: 3
可以解決問題。
ropsten: {
provider: () => new HDWalletProvider({
privateKeys: [testnetPrivateKey],
providerOrUrl: `https://eth-ropsten.alchemyapi.io/v2/${ropstenAlchemyApiKey}`,
////////////////////////////
chainId: 3 // add this
}),
看看這里chainid-vs-networkid了解更多關於chaindId
的細節
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.