Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Get Latest Block Number

GEThttps://deep-index.moralis.io/api/v2.2/latestBlockNumber/:chain

Returns the latest block number for the given chain.

PATH PARAMS
chainstring
The chain to query
Responses
200 Returns the latest block number.string
API KEY
import Moralis from 'moralis';

try {
await Moralis.start({
apiKey: "YOUR_API_KEY"
});

const response = await Moralis.EvmApi.block.getLatestBlockNumber({
"chain": "0x1"
});

console.log(response.raw);
} catch (e) {
console.error(e);
}
Response Example
"15863321"