Stay organized with collections
Save and categorize content based on your preferences.
This page provides information on how to handle blockchain UINT256 data types in Blockchain Analytics.
Lossless columns
Blockchain Analytics does not support UINT256 NUMERIC columns, but some blockchain data types have numerical precision up to UINT256.
In order to preserve the numerical precision, Blockchain Analytics datasets
presents UINT256 values in two separate columns:
An UINT128 NUMERIC column with potential loss of precision.
A STRING column containing the full decimal value in string form. The string
columns are marked with the _lossless prefix.
BigQuery User-Defined Functions (UDF)
Google Cloud hosts a Blockchain Analytics utility library that contains UDF for handling UINT256 computations and aggregations.
The following UDFs are relevant for UINT256 computation.
[[["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\u003ePre-GA products and features, like this one, are subject to the "Pre-GA Offerings Terms" and are available "as is" with potential limited support.\u003c/p\u003e\n"],["\u003cp\u003eBlockchain Analytics handles UINT256 data types by providing both a UINT128 NUMERIC column with potential precision loss and a \u003ccode\u003e_lossless\u003c/code\u003e prefixed STRING column for the full decimal value.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Cloud provides a Blockchain Analytics utility library with User-Defined Functions (UDFs) like \u003ccode\u003ebignumber_add\u003c/code\u003e, \u003ccode\u003ebignumber_sub\u003c/code\u003e, \u003ccode\u003ebignumber_mul\u003c/code\u003e, \u003ccode\u003ebignumber_div\u003c/code\u003e, \u003ccode\u003ebignumber_sum\u003c/code\u003e, and \u003ccode\u003ebignumber_avg\u003c/code\u003e for UINT256 computations.\u003c/p\u003e\n"],["\u003cp\u003eA sample query is provided that demonstrates how to use UDFs and the \u003ccode\u003e_lossless\u003c/code\u003e column to work with UINT256 values in BigQuery, specifically for summing and dividing withdrawals.\u003c/p\u003e\n"]]],[],null,["# UINT256 Handling\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 information on how to handle blockchain UINT256 data types in Blockchain Analytics.\n\nLossless columns\n----------------\n\nBlockchain Analytics does not support UINT256 NUMERIC columns, but some blockchain data types have numerical precision up to UINT256.\n\nIn order to preserve the numerical precision, Blockchain Analytics datasets\npresents UINT256 values in two separate columns:\n\n- An UINT128 NUMERIC column with potential loss of precision.\n- A STRING column containing the full decimal value in string form. The string columns are marked with the `_lossless` prefix.\n\nBigQuery User-Defined Functions (UDF)\n-------------------------------------\n\nGoogle Cloud hosts a Blockchain Analytics utility library that contains UDF for handling UINT256 computations and aggregations.\nThe following UDFs are relevant for UINT256 computation.\n\n- `bqutil.fn.bignumber_add`\n- `bqutil.fn.bignumber_sub`\n- `bqutil.fn.bignumber_mul`\n- `bqutil.fn.bignumber_div`\n- `bqutil.fn.bignumber_sum`\n- `bqutil.fn.bignumber_avg`\n\nSee the [BigQuery UDF GitHub repository](https://github.com/GoogleCloudPlatform/bigquery-utils/tree/master/udfs) for\ndetails on community managed BigQuery UDFs.\n\nSee the [BigQuery UDF documentation](/bigquery/docs/user-defined-functions) for\ninstructions on using BigQuery UDFs.\n\nLossless example with UDF workaround for UINT256\n------------------------------------------------\n\nIn the Google Cloud console, go to the **BigQuery** page.\n\n[Go to BigQuery](https://console.cloud.google.com/bigquery?sq=650023896125:fc20b24c8f8b4bb9aa2e3f02c8085e14)\n\nThe following query is loaded into the **Editor** field: \n\n WITH withdrawals AS (\n SELECT\n w.amount_lossless AS amount,\n DATE(b.block_timestamp) AS block_date\n FROM\n bigquery-public-data.blockchain_analytics_ethereum_mainnet_us.blocks AS b\n CROSS JOIN UNNEST(withdrawals) AS w\n )\n SELECT\n block_date,\n bqutil.fn.bignumber_div(bqutil.fn.bignumber_sum(ARRAY_AGG(amount)), \"1000000000\") AS eth_withdrawn\n FROM\n withdrawals\n GROUP BY 1 ORDER BY 1 DESC"]]