cURL
curl --compressed -X POST 'https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "tron",
"fromBlock": 79257136,
"toBlock": 79257200,
"fields": {
"block": { "number": true, "timestamp": true },
"log": {
"address": true,
"topics": true,
"data": true,
"transactionIndex": true,
"logIndex": true
}
},
"logs": [{
"address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
"topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}]
}'
import requests
response = requests.post(
"https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
json={
"type": "tron",
"fromBlock": 79257136,
"toBlock": 79257200,
"fields": {
"block": {"number": True, "timestamp": True},
"log": {
"address": True,
"topics": True,
"data": True,
"transactionIndex": True,
"logIndex": True,
},
},
"logs": [{
"address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
"topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
}],
},
)
blocks = [
__import__("json").loads(line)
for line in response.text.splitlines()
if line
]
const response = await fetch("https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "tron",
fromBlock: 79257136,
toBlock: 79257200,
fields: {
block: { number: true, timestamp: true },
log: {
address: true,
topics: true,
data: true,
transactionIndex: true,
logIndex: true,
},
},
logs: [{
address: ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
topic0: ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
}],
}),
});
const text = await response.text();
const blocks = text.split("\n").filter(Boolean).map((line) => JSON.parse(line));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
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([
'type' => 'tron',
'fromBlock' => 79257136,
'toBlock' => 79257200,
'fields' => [
'block' => [
'number' => true,
'timestamp' => true
],
'log' => [
'address' => true,
'topics' => true,
'data' => true,
'transactionIndex' => true,
'logIndex' => true
]
],
'logs' => [
[
'address' => [
'a614f803b6fd780986a42c78ec9c7f77e6ded13c'
],
'topic0' => [
'ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://portal.sqd.dev/datasets/tron-mainnet/finalized-stream"
payload := strings.NewReader("{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://portal.sqd.dev/datasets/tron-mainnet/finalized-stream")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"header": {
"number": 79257136,
"hash": "0000000004b95e300d9e52d878f88dba9776017f01923b8ab8c3680fc49b0771",
"timestamp": 1768435116000
},
"logs": [
{
"transactionIndex": 2,
"logIndex": 0,
"address": "a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"data": "00000000000000000000000000000000000000000000000000000003c4a67e65",
"topics": [
"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"000000000000000000000000056d10e7b4ffd1ea56fd26f7ba5cedb3cf022ed7",
"000000000000000000000000201ec2a6830ce97884f284db2c080612de342806"
]
}
],
"transactions": [],
"internalTransactions": []
}
]{
"error": {
"type": "invalid_request_error",
"code": "malformed_request",
"message": "Bad request: fromBlock must be a non-negative integer",
"param": "fromBlock"
}
}{
"error": {
"type": "invalid_request_error",
"code": "unknown_dataset",
"message": "Unknown dataset: no-such-chain"
}
}{
"error": {
"type": "invalid_request_error",
"code": "base_block_mismatch",
"message": "Base block mismatch"
},
"previousBlocks": [
{
"number": 21780871,
"hash": "0xab12cd..."
},
{
"number": 21780872,
"hash": "0xf6a96a29..."
}
]
}{
"error": {
"type": "rate_limit_error",
"code": "overloaded",
"message": "Service is overloaded, please try again later"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "Internal server error",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "availability_error",
"code": "upstream_unavailable",
"message": "Upstream data source is unavailable, please try again later",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "availability_error",
"code": "no_workers",
"message": "No workers available for dataset",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "rate_limit_error",
"code": "overloaded",
"message": "Service is overloaded, please try again later",
"request_id": "0198c3f1-..."
}
}Stream Finalized Blocks
Stream finalized Tron blockchain data with the SQD Portal API.
POST
/
finalized-stream
cURL
curl --compressed -X POST 'https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "tron",
"fromBlock": 79257136,
"toBlock": 79257200,
"fields": {
"block": { "number": true, "timestamp": true },
"log": {
"address": true,
"topics": true,
"data": true,
"transactionIndex": true,
"logIndex": true
}
},
"logs": [{
"address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
"topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}]
}'
import requests
response = requests.post(
"https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
json={
"type": "tron",
"fromBlock": 79257136,
"toBlock": 79257200,
"fields": {
"block": {"number": True, "timestamp": True},
"log": {
"address": True,
"topics": True,
"data": True,
"transactionIndex": True,
"logIndex": True,
},
},
"logs": [{
"address": ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
"topic0": ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
}],
},
)
blocks = [
__import__("json").loads(line)
for line in response.text.splitlines()
if line
]
const response = await fetch("https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "tron",
fromBlock: 79257136,
toBlock: 79257200,
fields: {
block: { number: true, timestamp: true },
log: {
address: true,
topics: true,
data: true,
transactionIndex: true,
logIndex: true,
},
},
logs: [{
address: ["a614f803b6fd780986a42c78ec9c7f77e6ded13c"],
topic0: ["ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],
}],
}),
});
const text = await response.text();
const blocks = text.split("\n").filter(Boolean).map((line) => JSON.parse(line));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream",
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([
'type' => 'tron',
'fromBlock' => 79257136,
'toBlock' => 79257200,
'fields' => [
'block' => [
'number' => true,
'timestamp' => true
],
'log' => [
'address' => true,
'topics' => true,
'data' => true,
'transactionIndex' => true,
'logIndex' => true
]
],
'logs' => [
[
'address' => [
'a614f803b6fd780986a42c78ec9c7f77e6ded13c'
],
'topic0' => [
'ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"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://portal.sqd.dev/datasets/tron-mainnet/finalized-stream"
payload := strings.NewReader("{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
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://portal.sqd.dev/datasets/tron-mainnet/finalized-stream")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://portal.sqd.dev/datasets/tron-mainnet/finalized-stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"tron\",\n \"fromBlock\": 79257136,\n \"toBlock\": 79257200,\n \"fields\": {\n \"block\": {\n \"number\": true,\n \"timestamp\": true\n },\n \"log\": {\n \"address\": true,\n \"topics\": true,\n \"data\": true,\n \"transactionIndex\": true,\n \"logIndex\": true\n }\n },\n \"logs\": [\n {\n \"address\": [\n \"a614f803b6fd780986a42c78ec9c7f77e6ded13c\"\n ],\n \"topic0\": [\n \"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"header": {
"number": 79257136,
"hash": "0000000004b95e300d9e52d878f88dba9776017f01923b8ab8c3680fc49b0771",
"timestamp": 1768435116000
},
"logs": [
{
"transactionIndex": 2,
"logIndex": 0,
"address": "a614f803b6fd780986a42c78ec9c7f77e6ded13c",
"data": "00000000000000000000000000000000000000000000000000000003c4a67e65",
"topics": [
"ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"000000000000000000000000056d10e7b4ffd1ea56fd26f7ba5cedb3cf022ed7",
"000000000000000000000000201ec2a6830ce97884f284db2c080612de342806"
]
}
],
"transactions": [],
"internalTransactions": []
}
]{
"error": {
"type": "invalid_request_error",
"code": "malformed_request",
"message": "Bad request: fromBlock must be a non-negative integer",
"param": "fromBlock"
}
}{
"error": {
"type": "invalid_request_error",
"code": "unknown_dataset",
"message": "Unknown dataset: no-such-chain"
}
}{
"error": {
"type": "invalid_request_error",
"code": "base_block_mismatch",
"message": "Base block mismatch"
},
"previousBlocks": [
{
"number": 21780871,
"hash": "0xab12cd..."
},
{
"number": 21780872,
"hash": "0xf6a96a29..."
}
]
}{
"error": {
"type": "rate_limit_error",
"code": "overloaded",
"message": "Service is overloaded, please try again later"
}
}{
"error": {
"type": "api_error",
"code": "internal_error",
"message": "Internal server error",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "availability_error",
"code": "upstream_unavailable",
"message": "Upstream data source is unavailable, please try again later",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "availability_error",
"code": "no_workers",
"message": "No workers available for dataset",
"request_id": "0198c3f1-..."
}
}{
"error": {
"type": "rate_limit_error",
"code": "overloaded",
"message": "Service is overloaded, please try again later",
"request_id": "0198c3f1-..."
}
}Body
application/json
Data query to filter and retrieve finalized blocks. Request body may be gzipped (Content-Encoding: gzip).
Response
A stream of finalized blocks in JSON lines format, optionally gzipped. Can be empty if the data query has a bounded range and all blocks in the range have been skipped.
Was this page helpful?