eth_getLogs RPC Method
Please be aware that the block range limit for this RPC method is 5 blocks for users on the Free Trial plan and 2,000 blocks for those on paid plans. Consider dividing your queries into smaller segments to enhance response times and manage errors more effectively. For further details on the block range limit and strategies for mitigating it, please consult the FAQ
Parameters
object
object
Loading...
fromBlock
string
Loading...
toBlock
string
Loading...
address
string
Loading...
topics
array
Loading...
blockHash
string
Loading...
Returns
result
Loading...
address
string
Loading...
topics
array
Loading...
data
string
Loading...
blockNumber
string
Loading...
transactionHash
string
Loading...
transactionIndex
string
Loading...
blockHash
string
Loading...
logIndex
string
Loading...
removed
boolean
Loading...
Request
1curl https://docs-demo.sei-pacific.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_getLogs",6"params": [7{8"fromBlock": "latest",9"toBlock": "latest"10}11],12"id": 1,13"jsonrpc": "2.0"14}'
1curl https://docs-demo.sei-pacific.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{5"method": "eth_getLogs",6"params": [7{8"fromBlock": "latest",9"toBlock": "latest"10}11],12"id": 1,13"jsonrpc": "2.0"14}'
1require 'eth'23client = Eth::Client.create 'https://docs-demo.sei-pacific.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_getLogs",7"params": [{"fromBlock": "latest", "toBlock": "latest"}],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1require 'eth'23client = Eth::Client.create 'https://docs-demo.sei-pacific.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_getLogs",7"params": [{"fromBlock": "latest", "toBlock": "latest"}],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1import { ethers } from "ethers";23(async () => {4try {5const provider = new ethers.JsonRpcProvider("https://docs-demo.sei-pacific.quiknode.pro/");67const filter = {8fromBlock: "latest",9toBlock: "latest"10};1112const logs = await provider.getLogs(filter);13console.log(logs);14} catch (error) {15console.error("Error fetching logs:", error);16}17})();
1import { ethers } from "ethers";23(async () => {4try {5const provider = new ethers.JsonRpcProvider("https://docs-demo.sei-pacific.quiknode.pro/");67const filter = {8fromBlock: "latest",9toBlock: "latest"10};1112const logs = await provider.getLogs(filter);13console.log(logs);14} catch (error) {15console.error("Error fetching logs:", error);16}17})();
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"method": "eth_getLogs",6"params": [7{8"fromBlock": "latest",9"toBlock": "latest"10}11],12"id": 1,13"jsonrpc": "2.0"14});1516var requestOptions = {17method: 'POST',18headers: myHeaders,19body: raw,20redirect: 'follow'21};2223fetch("https://docs-demo.sei-pacific.quiknode.pro/", requestOptions)24.then(response => response.text())25.then(result => console.log(result))26.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"method": "eth_getLogs",6"params": [7{8"fromBlock": "latest",9"toBlock": "latest"10}11],12"id": 1,13"jsonrpc": "2.0"14});1516var requestOptions = {17method: 'POST',18headers: myHeaders,19body: raw,20redirect: 'follow'21};2223fetch("https://docs-demo.sei-pacific.quiknode.pro/", requestOptions)24.then(response => response.text())25.then(result => console.log(result))26.catch(error => console.log('error', error));
1import requests2import json34url = "https://docs-demo.sei-pacific.quiknode.pro/"56payload = json.dumps({7"method": "eth_getLogs",8"params": [9{10"fromBlock": "latest",11"toBlock": "latest"12}13],14"id": 1,15"jsonrpc": "2.0"16})1718headers = {19'Content-Type': 'application/json'20}2122response = requests.request("POST", url, headers=headers, data=payload)23print(response.text)
1import requests2import json34url = "https://docs-demo.sei-pacific.quiknode.pro/"56payload = json.dumps({7"method": "eth_getLogs",8"params": [9{10"fromBlock": "latest",11"toBlock": "latest"12}13],14"id": 1,15"jsonrpc": "2.0"16})1718headers = {19'Content-Type': 'application/json'20}2122response = requests.request("POST", url, headers=headers, data=payload)23print(response.text)
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.sei-pacific.quiknode.pro/")6https = Net::HTTP.new(url.host, url.port)7https.use_ssl = true89request = Net::HTTP::Post.new(url)10request["Content-Type"] = "application/json"11request.body = JSON.dump({12"method": "eth_getLogs",13"params": [14{15"fromBlock": "latest",16"toBlock": "latest"17}18],19"id": 1,20"jsonrpc": "2.0"21})2223response = https.request(request)24puts response.read_body
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.sei-pacific.quiknode.pro/")6https = Net::HTTP.new(url.host, url.port)7https.use_ssl = true89request = Net::HTTP::Post.new(url)10request["Content-Type"] = "application/json"11request.body = JSON.dump({12"method": "eth_getLogs",13"params": [14{15"fromBlock": "latest",16"toBlock": "latest"17}18],19"id": 1,20"jsonrpc": "2.0"21})2223response = https.request(request)24puts response.read_body
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.sei-pacific.quiknode.pro/'))3print(w3.eth.get_logs({"address": "0xcb031F7066233Fb3c98Fa6e6E400d6559607B44D","blockHash": "0xc9274987f69cf4e8228d5a08d25c66b4c4b6df23e4d63af09bfd3ff7001a72a3"}))
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.sei-pacific.quiknode.pro/'))3print(w3.eth.get_logs({"address": "0xcb031F7066233Fb3c98Fa6e6E400d6559607B44D","blockHash": "0xc9274987f69cf4e8228d5a08d25c66b4c4b6df23e4d63af09bfd3ff7001a72a3"}))
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free