EthereumMethods

eth_getFilterChanges

Polling method for a filter, which returns an array of logs that occurred since the last poll. The filter must be created by calling either eth_newFilter or eth_newBlockFilter.

eth_getFilterChanges

Overview

Polling method for a filter, which returns an array of logs that occurred since the last poll. The filter must be created by calling either 'eth_newFilter' or 'eth_newBlockFilter'.

Request

shell

curl --request POST \
     --url https://ethereum-mainnet-geth-archive.node.coinapi.io \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "params": [
    "0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8",
    "latest"
  ],
  "method": "eth_getCode"
}'

csharp

var options = new RestClientOptions("https://ethereum-mainnet-geth-archive.node.coinapi.io");

var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json","X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY");
request.AddJsonBody("{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getCode\"}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

php

<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://ethereum-mainnet-geth-archive.node.coinapi.io",
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([
'id' => 1,
'jsonrpc' => '2.0',
'params' => [
'0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8',
'latest'
],
'method' => 'eth_getCode'
]),
CURLOPT_HTTPHEADER => [
"accept: application/json",
"content-type: application/json",
"X-CoinAPI-Key": "73034021-THIS-IS-SAMPLE-KEY"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>

python

import requests

url = "https://ethereum-mainnet-geth-archive.node.coinapi.io"

payload = {
    "id": 1,
    "jsonrpc": "2.0",
    "params": ["0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8", "latest"],
    "method": "eth_getCode"
}
headers = {
    "accept": "application/json",
    "content-type": "application/json",
    "X-CoinAPI-Key" : "73034021-THIS-IS-SAMPLE-KEY"

}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

javascript

const options = {
  method: 'POST',
  headers: {accept: 'application/json', 'content-type': 'application/json', 'X-CoinAPI-Key': '73034021-THIS-IS-SAMPLE-KEY'},
  body: JSON.stringify({
    id: 1,
    jsonrpc: '2.0',
    params: ['0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8', 'latest'],
    method: 'eth_getCode'
  })
};

fetch('https://ethereum-mainnet-geth-archive.node.coinapi.io', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

go

package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://ethereum-mainnet-geth-archive.node.coinapi.io"

	payload := strings.NewReader("{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getCode\"}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("accept", "application/json")
	req.Header.Add("content-type", "application/json")
  req.Header.Add("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}

ruby

require 'uri'
require 'net/http'

url = URI("https://ethereum-mainnet-geth-archive.node.coinapi.io")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["content-type"] = 'application/json'
request["X-CoinAPI-Key"] = '73034021-THIS-IS-SAMPLE-KEY'
request.body = "{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getCode\"}"

response = http.request(request)
puts response.read_body

java

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"id\":1,\"jsonrpc\":\"2.0\",\"params\":[\"0xe5cB067E90D5Cd1F8052B83562Ae670bA4A211a8\",\"latest\"],\"method\":\"eth_getCode\"}");
Request request = new Request.Builder()
  .url("https://ethereum-mainnet-geth-archive.node.coinapi.io")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("content-type", "application/json")
  .addHeader("X-CoinAPI-Key", "73034021-THIS-IS-SAMPLE-KEY")
  .build();

Response response = client.newCall(request).execute();

Request Parameters

  • 'filter ID': A string denoting the filter ID.

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "filter not found"
  }
}
  • log object array: An array of log objects, or an empty array if nothing has changed since the last poll.
  • For filters created with 'eth_newBlockFilter', the return values are block hashes (32 bytes), e.g. '["0x3454645634534..."]'.
  • For filters created with 'eth_newFilter', the logs are objects with the following parameters:
  • address: 20 bytes. Address from which this log originated.
  • blockHash: 32 bytes. The hash of the block where this log was in. 'Null' when it is a pending log.
  • blockNumber: The block number where this log was in. 'Null' when it is a pending log.
  • data: DATA. Contains the non-indexed arguments of the log.
  • logIndex: A hexadecimal of the log index position in the block. 'Null' when it is a pending log.
  • removed: 'true' when the log was removed, due to a chain reorganization. 'false' if it is a valid log.
  • topics: Array of DATA. An array of 0 to 4 32-bytes DATA of indexed log arguments. In Solidity, the first topic is the hash of the signature of the event (e.g., Deposit(address,bytes32,uint256)), except when you declared the event with the anonymous specifier.
  • transactionHash: 32 bytes. A hash of the transactions from which this log was created. 'Null' when it is a pending log.
  • transactionIndex: A hexadecimal of the transactions index position from which this log was created. 'Null' when it is a pending log.