BSC archival nodes not working

My BSC archive nodes aren’t working for several days now. any Web3 function call with a block number is timing out from my python script. I thought at first it was because I was requesting older blocks, but even ones from a few minutes ago are timing out.

the error I’m getting is this:

requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='speedy-nodes-nyc.moralis.io', port=443): Read timed out. (read timeout=10)

I’ve tried http, websocket, all manner of blocks and contracts. The most recent call to fail is attempting to call getReserves on bsc contract 0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16, which is PCS BNB/BUSD pair, at block 16142000, which is super recent, but everything I’ve tried for a couple of days just times out.

I’m on a paid plan specifically to be able to get archive data from past blocks… and my usage is not over quota, nor am I throttled because I haven’t been able to get any requests to work for a few days. My server url is https://xztdysmsh4lx.usemoralis.com:2053/server but it’s not really relevant because I’m using the speedy node archive endpoint. I can provide the speedy node url / api key on request.

My mainnet node endpoints are working fine, web3 api calls work, I can get events/transaction data, but none of them have some of the data I need, which is in function calls in past blocks.

Please help, my paid product isn’t working :confused:

Can you give an example of a minimal python script that does a request that doesn’t work?

1 Like

yessir, writing one now

from web3 import Web3
from web3.contract import Contract, ContractFunction
import json

ARCHIVE_HTTP = 'https://speedy-nodes-nyc.moralis.io/<apikey>/bsc/mainnet/archive'
w3archive = Web3(Web3.HTTPProvider(ARCHIVE_HTTP))

abistr = """
  [{
    "constant": true,
    "inputs": [],
    "name": "getReserves",
    "outputs": [
      { "internalType": "uint112", "name": "_reserve0", "type": "uint112" },
      { "internalType": "uint112", "name": "_reserve1", "type": "uint112" },
      {
        "internalType": "uint32",
        "name": "_blockTimestampLast",
        "type": "uint32"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  }]
"""

abi = json.loads(abistr)

c: Contract = w3archive.eth.contract(
    address='0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16', abi=abi)

res = c.functions.getReserves().call(block_identifier=16142000)
print(res)

the above script times out when i call it with my speedy node url. I can get you the URL if needed but I suspect you can look it up from my account information.

Ok, I’ll test it a little later. I can get your speedy node url if needed.

1 Like

thank you so much! FWIW, i tried with a couple other speedy node archive urls from other accounts and had the same issue.

also, going to the speedy node url directly in browser gives {"healthy":true}

it seems to be something related to python and that archive node in particular, using direct RPC call seems to work, for example this works fine:

curl -X POST https://speedy-nodes-nyc.moralis.io/fasfaf/bsc/mainnet/archive --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}" -H "Content-Type: application/json"
1 Like

can you give me a different archive node? I notice you’re not asking for anything with a past block in that call, either. anything for current block, i send through the non-archive node. Also, it worked until a couple days ago!

I have problems with running this:

from web3 import Web3

b = 'https://speedy-nodes-nyc.moralis.io/asfadfsdf/bsc/mainnet/archive'
web3 = Web3(Web3.HTTPProvider(b))
print(web3)
n = web3.eth.block_number
print(n)

the problem should be fixed soon

1 Like

I do, too. that’s a minimal example, indeed! hope it’s fixed soon!

yeah, i can confirm this works for me too. weird!

EDIT: I got an email reply from you, but I don’t see it showing up here on the forum, so I’m adding it here:

found out the problem

if you can patch this file:
web3_utils\request.py
for make_post_request function to add a line before

response = session.post(endpoint_uri, data=data, *args, **kwargs) 

to be:

data = data.replace(b" ", b'')
response = session.post(endpoint_uri, data=data, *args, **kwargs) 

then it should work on archive node too

I tried your patch, and it worked! thank you!!

1 Like

I deleted that reply because now it should work without that patch too