gpt4 book ai didi

blockchain - 尝试更新最新区 block 时遇到错误

转载 作者:行者123 更新时间:2023-12-05 03:27:33 25 4
gpt4 key购买 nike

我是区 block 链新手,我只是想将一个简单的智能合约部署到 ropsten 测试网。我使用了 https://github.com/t4sk/solidity-multi-sig-wallet 中的智能合约代码.此外,我正在使用 truffle develop

提供的帐户

我的 truffle-config.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"
// }
}
},

我使用的是 solidity: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:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848
var e = new Error('ETIMEDOUT')
^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: ETIMEDOUT
at Timeout.<anonymous> (C:\Users\coolg\Desktop\hd_wallet\node_modules\request\request.js:848:19)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
at PollingBlockTracker._performSync (C:\Users\coolg\Desktop\hd_wallet\node_modules\eth-block-tracker\src\polling.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 上的智能合约的功能/事件吗?

最佳答案

这里错误的问题可能是你试图到达的地址。我搜索了问题可能是什么,并找到了两个线程,人们已经在其中描述了问题并找到了解决方案。这些选项之一很可能有助于解决问题。

第一个解是here .这个想法是用wss替换https。应该是这样的:

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

然后我又搜索了一些,发现类似 this 的东西.帖子的作者说问题可能是由于 DNSslow internet 并建议在配置中添加两个参数:

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

关于blockchain - 尝试更新最新区 block 时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71447421/

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