[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThis page provides a query example for analyzing Tron blockchain data using BigQuery, specifically focusing on Tether (USDT) transfers.\u003c/p\u003e\n"],["\u003cp\u003ePre-GA product and features like this one may have limited support and are available under the "Pre-GA Offerings Terms" specified in the Service Specific Terms.\u003c/p\u003e\n"],["\u003cp\u003eThe provided SQL query in the BigQuery editor identifies and returns the three largest USDT transfer transactions that occurred on the Tron network during March 2023.\u003c/p\u003e\n"],["\u003cp\u003eA JavaScript function called \u003ccode\u003ehexToTron\u003c/code\u003e is defined within the SQL query to convert hexadecimal addresses into Tron-compatible base58 encoded addresses.\u003c/p\u003e\n"],["\u003cp\u003eThe example result displays the block number, sender and receiver addresses, and amount for each of the three largest transactions identified by the query.\u003c/p\u003e\n"]]],[],null,["# Tron example queries\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page provides Blockchain Analytics query examples for Tron.\n\nSee the [BigQuery documentation](/bigquery/docs/introduction) for\ninstructions on using BigQuery.\n\nTether transfers with the largest amounts in a month\n----------------------------------------------------\n\nThis query returns the three largest USDT transfers in March 2023.\n\nIn the Google Cloud console, go to the **BigQuery** page.\n\n[Go to BigQuery](https://console.cloud.google.com/bigquery?sq=650023896125:d7d7ca8368dc4346b8618d3ea3d11128)\n\nThe following query is loaded into the **Editor** field: \n\n CREATE TEMP FUNCTION hexToTron(address STRING)\n RETURNS STRING\n LANGUAGE js\n OPTIONS (library=[\"gs://blockchain-etl-bigquery/ethers.js\"])\n AS r\"\"\"\n function encode58(buffer) {\n const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n const digits = [0];\n for (let i = 0; i \u003c buffer.length; i++) {\n for (let j = 0; j \u003c digits.length; j++) digits[j] \u003c\u003c= 8;\n digits[0] += buffer[i];\n let carry = 0;\n for (let j = 0; j \u003c digits.length; ++j) {\n digits[j] += carry;\n carry = (digits[j] / 58) | 0;\n digits[j] %= 58;\n }\n while (carry) {\n digits.push(carry % 58);\n carry = (carry / 58) | 0;\n }\n }\n for (let i = 0; buffer[i] === 0 && i \u003c buffer.length - 1; i++) digits.push(0);\n return digits.reverse().map((digit) =\u003e ALPHABET[digit]).join(\"\");\n }\n\n function sha256(msgBytes) {\n const msgHex = ethers.utils.hexlify(msgBytes);\n const hashHex = ethers.utils.sha256(msgHex);\n return ethers.utils.arrayify(hashHex);\n }\n\n addressBytes = ethers.utils.arrayify('0x' + address.replace(/^0x/, '41'))\n checkSum = sha256(sha256(addressBytes)).slice(0, 4);\n return encode58(new Uint8Array([...addressBytes, ...checkSum]));\n \"\"\";\n\n WITH transfers AS (\n SELECT\n block_number,\n hexToTron(CONCAT('0x', SUBSTR(topics[1], 27))) AS from_address,\n hexToTron(CONCAT('0x', SUBSTR(topics[2], 27))) AS to_address,\n CAST(data AS INT64) / 1000000 AS amount\n FROM\n `bigquery-public-data.goog_blockchain_tron_mainnet_us.logs` l\n WHERE\n address = '0xa614f803b6fd780986a42c78ec9c7f77e6ded13c' -- USDT contract\n AND ARRAY_LENGTH(topics) = 3\n AND topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Transfer events\n AND DATE(block_timestamp) BETWEEN \"2023-03-01\" AND \"2023-03-31\"\n )\n SELECT * FROM transfers ORDER BY amount DESC LIMIT 3;\n\nThe following shows an example result:"]]