尝试更新最新块时遇到错误



我是区块链的新手,我只是想把一个简单的智能合约部署到ropsten测试网。我使用了来自的智能合约代码https://github.com/t4sk/solidity-multi-sig-wallet.此外,我正在使用松露开发提供的帐户

我的松露-fig.js:

networks: {
development: {
host: "127.0.0.1",     // Localhost (default: none)
port: 8545,            // Standard Ethereum port (default: none)
network_id: "*",       // Any network (default: none)
},
ropsten: {
provider: () => new HDWalletProvider(mnemonic, `https://ropsten.infura.io/v3/${infuraKey}`),
network_id: 3,       // Ropsten's id
gas: 5500000,        // Ropsten has a lower block limit than mainnet
confirmations: 2,    // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200,  // # of blocks before a deployment times out  (minimum/default: 50)
skipDryRun: true     // Skip dry run before migrations? (default: false for public nets )
},
mocha: {
timeout: 100000
},
compilers: {
solc: {
version: "0.5.1",    // Fetch exact version from solc-bin (default: truffle's version)
// docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
// settings: {          // See the solidity docs for advice about optimization and evmVersion
optimizer: {
enabled: false,
runs: 200
},
//  evmVersion: "byzantium"
// }
}
},

Im使用的固体度:0.5.1

但是,当我尝试使用truffle migrate--network ropsten部署它时,我得到了以下两个错误

1.

This version of µWS is not compatible with your Node.js build:
Error: Cannot find module './uws_win32_x64_72.node'
Falling back to a NodeJS implementation; performance may be degraded.
1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash:    0x673a9a02662595075c6f3aa4dc904d24203cb8e460a3e20a630869c5155cb78c
> Blocks: 2            Seconds: 53
> contract address:    0xde674E126884c8F7Ddd94B5013065596b81fEd6d
> block number:        12075322
> block timestamp:     1647065140
> account:             0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
> balance:             1.830076836873988898
> gas used:            175087 (0x2abef)
> gas price:           2.500000028 gwei
> value sent:          0 ETH
> total cost:          0.000437717504902436 ETH
Pausing for 2 confirmations...
-------------------------------
C:UserscoolgDesktophd_walletnode_modulesrequestrequest.js:848
var e = new Error('ETIMEDOUT')
^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
at Timeout.<anonymous> (C:UserscoolgDesktophd_walletnode_modulesrequestrequest.js:848:19)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
at PollingBlockTracker._performSync (C:UserscoolgDesktophd_walletnode_moduleseth-block-trackersrcpolling.js:51:24)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

此外,在ropsten网络上创建了上述智能合约地址0xde674E126884c8F7Ddd94B5013065596b81fEd6d的事务。

编辑1:我已将提供者链接替换为wss://ropsten.infura.io/v3/${infuraKey}`,第二个问题得到解决,但现在它显示另一个错误

1_initial_migration.js
======================
Deploying 'Migrations'
----------------------
> transaction hash:    0xb72aef24e5fc16395f1dc221965c4e2036b4d72babbe829f244f958d302baee5
> Blocks: 7            Seconds: 228
> contract address:    0xb81478b107D5B08B0F9ce8d0E404701a3D2292a0
> block number:        12076445
> block timestamp:     1647090364
> account:             0xC10352218af6Ccbb574Fd0912adcc9Ac59C22950
> balance:             1.828763684345799891
> gas used:            175087 (0x2abef)
> gas price:           2.500000007 gwei
> value sent:          0 ETH
> total cost:          0.000437717501225609 ETH
Pausing for 2 confirmations...
-------------------------------
> confirmation number: 3 (block: 12076452)
⠦ Saving migration to chain.
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.

Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!

它说交易可能仍然被挖掘,那么我怎么知道我的交易何时被挖掘?同时,我可以调用部署在ropsten_eth上的智能合约的函数/事件吗https://ropsten.etherscan.io/address/0xb81478b107d5b08b0f9ce8d0e404701a3d2292a0

这里的问题可能是您试图访问的地址。我搜索了可能的问题,发现了两个线索,人们已经描述了这个问题,并找到了解决方案。这些选项中的一个很可能有助于解决问题。

第一个解决方案就在这里。这个想法是用wss代替https。应该有这样的东西:

testnet: {
provider: () => new HDWalletProvider(mnemonic, `wss://ropsten.infura.io/v3/${infuraKey}`),
...
}

然后我又搜索了一些,发现了这样的东西。该帖子的作者表示,问题可能是由于DNS互联网速度慢造成的,并建议在配置中添加两个参数:

testnet: {
...,
networkCheckTimeout: 10000,
timeoutBlocks: 200
}

最新更新