Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Etherscan request times out when requesting constructor args #39

Closed
BruceChar opened this issue Oct 13, 2020 · 27 comments
Closed

Etherscan request times out when requesting constructor args #39

BruceChar opened this issue Oct 13, 2020 · 27 comments
Labels
bug Something isn't working help wanted Extra attention is needed needs-investigation Need to (find time to) investigate further wontfix This will not be worked on

Comments

@BruceChar
Copy link

I followed the instructions but failed.

Running truffle-plugin-verify v0.4.0
Verifying Token
Reading artifact file at E:\MyProject\BlockChain\truffle-contracts\abis/Token.json
Retrieving constructor parameters from https://api-ropsten.etherscan.io/api?apiKey=my_api_key&module=account&action=txlist&address=0x4C9D6ed005bfB301726cA23adE690890B853fB60&page=1&sort=asc&offset=1
Failed to connect to Etherscan API at url https://api-ropsten.etherscan.io/api
Failed to verify 1 contract(s): Token

It seems the network problem. But It migrated successfully. when I try to connect to the verify url, it returns right:

PS E:\MyProject\BlockChain\truffle-contracts> curl https://api-ropsten.etherscan.io/api          

StatusCode        : 200
StatusDescription : OK
Content           : {"status":"0","message":"NOTOK-Missing/Invalid API Key, rate limit of 1/5sec 
                     applied","result":"Error! Missing Or invalid Module name"}
RawContent        : HTTP/1.1 200 OK
...

VSCode IDE
truffle version: v5.1.48
OS: windows 10

Thanks!

@rkalis
Copy link
Owner

rkalis commented Oct 13, 2020

Hmm that is interesting. When I copy the link in your debug logs (https://api-ropsten.etherscan.io/api?apiKey=my_api_key&module=account&action=txlist&address=0x4C9D6ed005bfB301726cA23adE690890B853fB60&page=1&sort=asc&offset=1) and replace "my_api_key" with my own API key, the request works.

Are you sure you set up your Etherscan API key in your truffle-config.js correctly?

module.exports = {
  /* ... rest of truffle-config */

  api_keys: {
    etherscan: 'MY_API_KEY'
  }
}

@rkalis
Copy link
Owner

rkalis commented Oct 13, 2020

I should probably update the plugin to display the Etherscan response message to the debug logs so that it shows why the request failed 😅

@BruceChar
Copy link
Author

@rkalis Yes!I have set up my Etherscan API key in truffle-config.js.

  plugins: [
    'truffle-plugin-verify'
  ],

  api_keys: {
    etherscan: process.env.ETHSCAN_API_KEY
  }

and in file .env

ETHSCAN_API_KEY="MY_API_KEY"

@rkalis
Copy link
Owner

rkalis commented Oct 14, 2020

Can you try going to this link (https://api-ropsten.etherscan.io/api?apiKey=my_api_key&module=account&action=txlist&address=0x4C9D6ed005bfB301726cA23adE690890B853fB60&page=1&sort=asc&offset=1), with your api key filled in?

Browser or curl should work.

@rkalis
Copy link
Owner

rkalis commented Oct 16, 2020

Alternatively, do you have a repository that I can look at to reproduce this issue?

@JoyCood
Copy link

JoyCood commented Nov 15, 2020

i meet the same problem..how to slove this issue?

@JoyCood
Copy link

JoyCood commented Nov 15, 2020

I should probably update the plugin to display the Etherscan response message to the debug logs so that it shows why the request failed 😅

yes!

@rkalis
Copy link
Owner

rkalis commented Nov 15, 2020

Please provide some more information. Do you have a repository that can reproduce this issue? Can you run the verify command using the --debug flag and paste output?

@JoyCood
Copy link

JoyCood commented Nov 15, 2020

Please provide some more information. Do you have a repository that can reproduce this issue? Can you run the verify command using the --debug flag and paste output?

D:\contract\pet>truffle run verify Adoption@0x830dAef5E0f6D39aD689F979bb3AB468c58017FF --network rinkeby --debug
DEBUG logging is turned ON
Running truffle-plugin-verify v0.5.0
Verifying Adoption@0x830dAef5E0f6D39aD689F979bb3AB468c58017FF
Reading artifact file at D:\contract\pet\build\contracts\Adoption.json
Custom address 0x830dAef5E0f6D39aD689F979bb3AB468c58017FF specified
Retrieving constructor parameters from https://api-rinkeby.etherscan.io/api?apiKey=My_API_Key&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1
Failed to connect to Etherscan API at url https://api-rinkeby.etherscan.io/api
Failed to verify 1 contract(s): Adoption@0x830dAef5E0f6D39aD689F979bb3AB468c58017FF

@rkalis
Copy link
Owner

rkalis commented Nov 15, 2020

Could you tell me what happens if you enter the link above (api-rinkeby.etherscan.io/api?apiKey=My_API_Key&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1) into a browser (but with your own API key instead of My_API_Key) and copy paste the result?

@JoyCood
Copy link

JoyCood commented Nov 16, 2020

Could you tell me what happens if you enter the link above (api-rinkeby.etherscan.io/api?apiKey=My_API_Key&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1) into a browser (but with your own API key instead of My_API_Key) and copy paste the result?

{"status":"1","message":"OK","result":[{"blockNumber":"7552433","timeStamp":"1605444916","hash":"0x3a7ac408893c111ff3b2f703e020b42f6c11ae2e34166b112086aa51528b85c3","nonce":"9","blockHash":"0x930411e35437b48869009ddd5056acc1c4e5f22fc564231de1e7e50fc0aa6f07","transactionIndex":"2","from":"0xd683358a0d2250f8f3efcaa649192e580c877af3","to":"","value":"0","gas":"4500000","gasPrice":"10000000000","isError":"0","txreceipt_status":"1","input":"0x608060405234801561001057600080fd5b506102a4806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80633de4eb171461004657806343ae80d31461008c5780638588b2c5146100e4575b600080fd5b61004e610126565b6040518082601060200280838360005b8381101561007957808201518184015260208101905061005e565b5050505090500191505060405180910390f35b6100b8600480360360208110156100a257600080fd5b81019080803590602001909291905050506101a7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610110600480360360208110156100fa57600080fd5b81019080803590602001909291905050506101da565b6040518082815260200191505060405180910390f35b61012e61024b565b600060108060200260405190810160405280929190826010801561019d576020028201915b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311610153575b5050505050905090565b600081601081106101b457fe5b016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008082101580156101ed5750600f8211155b6101f657600080fd5b336000836010811061020457fe5b0160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550819050919050565b60405180610200016040528060109060208202803683378082019150509050509056fea264697066735822122091c9490c3bd1f9a494854218bfba1345831d8cc07d7744807fea9506a767de2964736f6c634300060c0033","contractAddress":"0x830daef5e0f6d39ad689f979bb3ab468c58017ff","cumulativeGasUsed":"487596","gasUsed":"199279","confirmations":"3176"}]}

@rkalis
Copy link
Owner

rkalis commented Nov 19, 2020

Hmm that's odd.

I just released v0.5.1 of the plugin which should log the actual error that was thrown in the Etherscan request. Could you update to use v0.5.1 and try to verify again using the --debug flag. It should now display more debugging information.

@JoyCood
Copy link

JoyCood commented Nov 21, 2020

Hmm that's odd.

I just released v0.5.1 of the plugin which should log the actual error that was thrown in the Etherscan request. Could you update to use v0.5.1 and try to verify again using the --debug flag. It should now display more debugging information.

how to update to latest version of truffle-plugin-verify on windows 10?

@rkalis
Copy link
Owner

rkalis commented Nov 21, 2020

I don't know a lot about windows, but I assume you have NPM installed, so you can run npm install truffle-plugin-verify@latest

@JoyCood
Copy link

JoyCood commented Nov 21, 2020

Hmm that's odd.

I just released v0.5.1 of the plugin which should log the actual error that was thrown in the Etherscan request. Could you update to use v0.5.1 and try to verify again using the --debug flag. It should now display more debugging information.

D:\contract\pet>truffle run verify Adoption --network rinkeby --debug
DEBUG logging is turned ON
Running truffle-plugin-verify v0.5.1
Verifying Adoption
Reading artifact file at D:\contract\pet\build\contracts\Adoption.json
Retrieving constructor parameters from https://api-rinkeby.etherscan.io/api?apiKey=My_API_KEY&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1
connect ETIMEDOUT 103.252.115.221:443
Failed to connect to Etherscan API at url https://api-rinkeby.etherscan.io/api
Failed to verify 1 contract(s): Adoption

@rkalis
Copy link
Owner

rkalis commented Nov 21, 2020

Thanks for the update! Interesting, so the connection is timing out. I'm assuming that this is also the cause for @BruceChar and perhaps also for #40 🤔

@Enigmatic331 do you have an idea why this request might be returning an ETIMEDOUT (it's working in the browser).

@Enigmatic331
Copy link

Hey Rosco sorry that I missed this (and the other one). I'll take a look to see what might be missing here.

@rkalis
Copy link
Owner

rkalis commented Nov 21, 2020

Looking at the other issue #40, they are getting a timed out when using curl as well.

@rkalis rkalis changed the title Fail-to-verify-contracts Etherscan request times out when requesting constructor args Nov 21, 2020
@Enigmatic331
Copy link

Enigmatic331 commented Nov 23, 2020

Hey @JoyCood, could you give it a quick check to see if it's currently still persisting for you?

Likewise also, @white-black-hong - Is this still happening?

Thanks.

@JoyCood
Copy link

JoyCood commented Nov 23, 2020

Hey @JoyCood, could you give it a quick check to see if it's currently still persisting for you?

Likewise also, @white-black-hong - Is this still happening?

Thanks.

unfortunaly, it is not work yet, the output after command run:

$ truffle run verify Adoption --network rinkeby --debug

DEBUG logging is turned ON
Running truffle-plugin-verify v0.5.1
Verifying Adoption
Reading artifact file at D:\contract\pet\build\contracts\Adoption.json
Retrieving constructor parameters from https://api-rinkeby.etherscan.io/api?> apiKey=MY_API_KEY&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1
connect ETIMEDOUT 108.160.172.232:443
Failed to connect to Etherscan API at url https://api-rinkeby.etherscan.io/api
Failed to verify 1 contract(s): Adoption`

@solnex
Copy link

solnex commented Dec 9, 2020

same thing to me

NFT admain$ truffle run verify NFTToken --network kovan --debug
DEBUG logging is turned ON Running truffle-plugin-verify v0.5.2 Verifying NFTToken Reading artifact file at /Users/admin/myproject/NFT/build/contracts/NFTToken.json Retrieving constructor parameters from https://api-kovan.etherscan.io/api?apiKey= MY_API_KEY&module=account&action=txlist&address=0x76e5A416c9215564f9D69992D96D7f20Eed2Fd12&page=1&sort=asc&offset=1 connect ETIMEDOUT 185.60.219.41:443 Failed to connect to Etherscan API at url https://api-kovan.etherscan.io/api Failed to verify 1 contract(s): NFTToken

@rkalis
Copy link
Owner

rkalis commented Dec 11, 2020

I'm getting it myself as well every now and then. Sometimes it also returns an ETIMEDOUT at later requests (e.g. retrieving constructor args is fine, sending verify request as well, but getting verification status fails).

Any idea what could be happening here @Enigmatic331?

@solnex
Copy link

solnex commented Dec 14, 2020

Hey @JoyCood, could you give it a quick check to see if it's currently still persisting for you?
Likewise also, @white-black-hong - Is this still happening?
Thanks.

unfortunaly, it is not work yet, the output after command run:

$ truffle run verify Adoption --network rinkeby --debug

DEBUG logging is turned ON
Running truffle-plugin-verify v0.5.1
Verifying Adoption
Reading artifact file at D:\contract\pet\build\contracts\Adoption.json
Retrieving constructor parameters from https://api-rinkeby.etherscan.io/api?> apiKey=MY_API_KEY&module=account&action=txlist&address=0x830dAef5E0f6D39aD689F979bb3AB468c58017FF&page=1&sort=asc&offset=1
connect ETIMEDOUT 108.160.172.232:443
Failed to connect to Etherscan API at url https://api-rinkeby.etherscan.io/api
Failed to verify 1 contract(s): Adoption`

You can run the command export https_proxy="http://127.0.0.1:1087" to set the endPoint proxy, remember to replace the port with your network proxy setting.It works for me.

@Sheldenshi
Copy link

generate a new API key on etherscan. At least that solved the issue for me.

@rkalis rkalis added bug Something isn't working help wanted Extra attention is needed needs-investigation Need to (find time to) investigate further labels May 7, 2021
@rkalis
Copy link
Owner

rkalis commented Sep 10, 2021

It has been a long time without activity on this issue and I don't think timeouts from Etherscan are something I'll be able to do something about in the plugin. So I will close this issue as a wontfix.

@rkalis rkalis closed this as completed Sep 10, 2021
@rkalis rkalis added the wontfix This will not be worked on label Sep 10, 2021
@SomeJoker
Copy link

I miss the same problem.
The reason for my problem is: the ip obtained by DNS resolution of the domain name cannot be connected.
I check api-rinkeby.etherscan.io get useable IP, add this IP mapping api-rinkeby.etherscan.io to my local hosts file. Then I solve this problem.

That's get domain name mapping IP network.
https://url5.co/?t=1636355893

@clearloop
Copy link

clearloop commented Jan 23, 2022

same here, this issue related to our network but not caused by the code in this repo

@ChoongLiang
Copy link

The problem for me was the parameter I sent was wrong.

It's supposed to be contractaddress=0xcontractaddress and NOT address=contractaddress

@Azleal
Copy link

Azleal commented Jun 20, 2022

I ran the command with --debug option, I can open the https://api-rinkeby.etherscan.io/api?apiKey=xxx... in the browser, however, in the command line mode, timeout everytime.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed needs-investigation Need to (find time to) investigate further wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

10 participants