Hi Can any one help me on api to get the latest block number for Algorand
JS API:
#### Retrieving Latest Block InformationTo retrieve the latest blockâs information you would use the algod client wrapper functions shown below.
const algosdk = require('algosdk'); //Retrieve the token, server and port values for your installation in the algod.net //and algod.token files within the data directory const atoken = "d60cb951132a5fed9dde1abeadd4ea02b2c8d9815ee1eb1cb932941eaa3821c8"; const aserver = "http://127.0.0.1"; const aport = 8080; const algodclient = new algosdk.Algod(atoken, aserver, aport); (async () => { let lastround = (await algodclient.status()).lastRound; let block = (await algodclient.block(lastround)); console.log( block ); })().catch(e => { console.log(e); });
taken from
https://developer.algorand.org/docs/javascript-sdk
https://developer.algorand.org/docs/build-apps/connect/#check-node-status-and-network-version
now shows all languages.
do we have any api or curl query to get it from Node. I have Algorand Node set up already.
See the new docs, Algorand Developer Portal
Call the *status* and *version* methods from the algod client to check the details of your connection. This information is also available through equivalent REST API calls and `goal` commands.JavaScript Python Java Go cURL
curl -i -X GET \ -H âX-Algo-API-Token:â \ âhttp://:/v1/statusâ
goal
The status methods return information about the status of the node, such as the latest round, referred to as
lastRound
, from the perspective of the node you are connected to. Each of the SDKs may differ slightly in which information they return for each call. Shown below is the response from the REST API call.Response
{ âlastRoundâ: 4243027, âlastConsensusVersionâ: âGitHub - algorandfoundation/specs at 4a9db6a25595c6fd097cf9cc137cc83027787eaaâ, ânextConsensusVersionâ: âGitHub - algorandfoundation/specs at 4a9db6a25595c6fd097cf9cc137cc83027787eaaâ, ânextConsensusVersionRoundâ: 4243028, ânextConsensusVersionSupportedâ: true, âtimeSinceLastRoundâ: 4261519666, âcatchupTimeâ: 0, âhasSyncedSinceStartupâ: false }
@Maugli thanks for the quick help . Could you please let me know the Source of CURL queries