Whenever I try to get the block using the eosjs in NodeJS like in the example I get the error 'Invalid Block number or ID, must be greater than 0 and less than 64 characters'

Altho when I use other fetch methods such as the fetch from nodeos, it works just fine: https://developers.eos.io/eosio-nodeos/reference#get-block

I got the info on how to do this fetch from the eos documentation: https://eosio.github.io/eosjs/latest/reading-blockchain-examples/#get-block

const { JsonRpc } = require('eosjs');
const fetch = require('node-fetch');
const rpc = new JsonRpc('https://api.eosnewyork.io/', { fetch });

async function main() {
  try {
    let info = await rpc.get_info();
    console.log(await rpc.get_block(info.last_irreversible_block_num));
  } catch (error) {

1 Answer 1


EOS New York disabled get_block API. Use another endpoint. You can find one from the next:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.