Contract-Deployment

Infura:在 Rinkeby 上部署時出現證書已過期錯誤

  • October 27, 2020

我嘗試使用 Infura 在 Rinkeby 上部署一些合約,但出現以下錯誤:

Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }

(完整的堆棧跟踪在問題的底部。)

我正在使用部署腳本:

if (network == 'rinkeby') {
       // Overriding default config for rinkeby test net
       defaultConfigs.chainId = 4;
       // Setting private key for this network
       secret = process.env.DEPLOYER_PRIVATE_KEY_RINKEBY;
       // Setting the RPC
       RPC = `https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}`;

       console.log("Deploying to Rinkeby network");
}

這個腳本使用了 Etherlime 的工具(在腳本的其他地方,我沒有把它全部帶上,因為它似乎可以工作,你馬上就會看到我可以使用它部署在本地 RPC 上),並且你可以dotenv假設據我所知,環境變數設置正確。

最後,我最終啟動了一個本地 Rinkeby 節點並使用本地相同的腳本進行部署 - 我只是將 RPC 變數更改為 hit localhost,並且效果很好。(所以據我所知,Etherlime 沒有問題。)

這裡出了什麼問題?

附錄

這是整個堆棧跟踪,其中一些細節(如實際的 Infura API 密鑰)已被編輯:

➜ yarn deploy:rinkeby
yarn run v1.22.5
$ etherlime deploy --network=rinkeby --runs=500
Compilation finished successfully
Deploying to Rinkeby network
Deployer set to deploy from address: 0x...

JSONRPC Deployer Network: https:/rinkeby.infura.io/v3/...

Deploying contract: Library_Token
{ Error: invalid response - 0
   at exports.XMLHttpRequest.request.onreadystatechange (/home/x/code/project/Blockchain/node_modules/etherlime-lib/node_modules/ethers/utils/web.js:84:29)
   at exports.XMLHttpRequest.dispatchEvent (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
   at setState (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
   at exports.XMLHttpRequest.handleError (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:532:5)
   at ClientRequest.errorHandler (/home/x/code/project/Blockchain/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:459:14)
   at ClientRequest.emit (events.js:198:13)
   at TLSSocket.socketErrorListener (_http_client.js:401:9)
   at TLSSocket.emit (events.js:198:13)
   at emitErrorNT (internal/streams/destroy.js:91:8)
   at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
 statusCode: 0,
 responseText:
  'Error: certificate has expired\n    at TLSSocket.onConnectSecure (_tls_wrap.js:1088:34)\n    at TLSSocket.emit (events.js:198:13)\n    at TLSSocket._finishInit (_tls_wrap.js:666:8)' }
Your deployment script finished with failure!

Here is your report:

Done in 32.09s.

感謝您的閱讀,如果您花時間寫一個答案,非常感謝!

問題是/您的網址中缺少 a 。以下行應該有https://和沒有https:/

RPC = 'https:/rinkeby.infura.io/v3/${process.env.INFURA_API_KEY_RINKEBY}';

引用自:https://ethereum.stackexchange.com/questions/89599