getLatestBlock
Learn how to use the getLatestBlock JSON-RPC method.
POST
/
#particle_getLatestBlock
getLatestBlock
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_getLatestBlock' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_getLatestBlock",
"chainId": 1,
"params": []
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_getLatestBlock"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_getLatestBlock",
"chainId": 1,
"params": []
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'particle_getLatestBlock',
chainId: 1,
params: []
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_getLatestBlock', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_getLatestBlock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_getLatestBlock',
'chainId' => 1,
'params' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_getLatestBlock"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_getLatestBlock")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_getLatestBlock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": "<string>",
"extraData": "<string>",
"gasLimit": "<string>",
"gasUsed": "<string>",
"hash": "<string>",
"logsBloom": "<string>",
"miner": "<string>",
"mixHash": "<string>",
"nonce": "<string>",
"number": "<string>",
"parentHash": "<string>",
"receiptsRoot": "<string>",
"sha3Uncles": "<string>",
"size": "<string>",
"stateRoot": "<string>",
"timestamp": "<string>",
"totalDifficulty": "<string>",
"transactions": [
{}
],
"transactionsRoot": "<string>",
"uncles": [
{}
],
"receipts": [
{}
]
}
}Contextualizing getLatestBlock
-
getlatestBlockreturns a highly detailed response containing both standard and extraneous information about the latest block on the chain associated withchainId. This response includes full receipts of transactions contained within the latest block. This is non-toggleable.
Returned receipts contain the following attributes
JSON
// Example receipt
"blockHash":"0x9468f7e44e89921b38eb4812ec5dc7900ceffc454aecb0a452d9477952062efc",
"blockNumber":"0x11868d0",
"contractAddress":null,
"cumulativeGasUsed":"0x9e0096",
"effectiveGasPrice":"0x3094e55d9",
"from":"0x3527439923a63f8c13cf72b8fe80a77f6e572092",
"gasUsed":"0xbbad2",
"logs":[
{
"address":"0x32400084c286cf3e17e7b677ea9583e60a000324",
"blockHash":"0x9468f7e44e89921b38eb4812ec5dc7900ceffc454aecb0a452d9477952062efc",
"blockNumber":"0x11868d0",
"data":"0x",
"logIndex":"0x1b",
"removed":false,
"topics":[
"0x22c9005dd88c18b552a1cd7e8b3b937fcde9ca69213c1f658f54d572e4877a81",
"0x0000000000000000000000000000000000000000000000000000000000042fc4",
"0x0000000000000000000000000000000000000000000000000000000000042fc5"
],
"transactionHash":"0x373c6917650568746f2cb9a99c9250ef5c5fdda380ac0e322779e9532c0d5153",
"transactionIndex":"0x10"
}
],
"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000010020000000000000000000002020000000000000000000000000000000000000000100000400000000000000000000000000000000000000000000000000000000000000000000000010000000000000000001000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000001000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status":"0x1",
"to":"0x3db52ce065f728011ac6732222270b3f2360d919",
"transactionHash":"0x373c6917650568746f2cb9a99c9250ef5c5fdda380ac0e322779e9532c0d5153",
"transactionIndex":"0x10",
"type":"0x2"
Authorizations
Body
application/json
Was this page helpful?
⌘I
getLatestBlock
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_getLatestBlock' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_getLatestBlock",
"chainId": 1,
"params": []
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_getLatestBlock"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_getLatestBlock",
"chainId": 1,
"params": []
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'particle_getLatestBlock',
chainId: 1,
params: []
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_getLatestBlock', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_getLatestBlock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_getLatestBlock',
'chainId' => 1,
'params' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_getLatestBlock"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_getLatestBlock")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_getLatestBlock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_getLatestBlock\",\n \"chainId\": 1,\n \"params\": []\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": {
"difficulty": "<string>",
"extraData": "<string>",
"gasLimit": "<string>",
"gasUsed": "<string>",
"hash": "<string>",
"logsBloom": "<string>",
"miner": "<string>",
"mixHash": "<string>",
"nonce": "<string>",
"number": "<string>",
"parentHash": "<string>",
"receiptsRoot": "<string>",
"sha3Uncles": "<string>",
"size": "<string>",
"stateRoot": "<string>",
"timestamp": "<string>",
"totalDifficulty": "<string>",
"transactions": [
{}
],
"transactionsRoot": "<string>",
"uncles": [
{}
],
"receipts": [
{}
]
}
}