Flipside Docs
  • Welcome to Flipside!
    • Welcome to Flipside
    • Growth Services
    • Data
      • Choose your Flipside plan
        • Free
        • Builder
        • Pro
          • Get Started in Snowflake
          • Incremental Table Pattern
          • Copy Data from Snowflake to AWS
          • Copy Data from Snowflake to GCP
          • Copy Data from Snowflake to Azure
        • Snowflake Data Shares
          • Mounting a Snowflake Data Share
    • Earn
    • Community
  • Data
    • Flipside Data
      • Table Docs by Chain
      • Data Modeling Approach
      • Labels
        • Centralized Exchange Label Type
        • Decentralized Exchange Label Type
        • Operator Label Type
        • Chain Admin Label Type
        • Decentralized Finance Label Type
        • NonFungible Tokens Label Type
        • Games Label Type
        • Bridge Label Type
        • Decentralized Applications Label Type
        • Token Label Type
        • Flotsam Label Type
      • Tags
      • Table Freshness Targets
      • Contribute to Our Data
        • Contract Decoding & ABIs
        • How to Add Your Own Tags
        • Community Curation
          • Getting Started
            • Contribution Workflow
          • Model Standards
            • dbt Tips
          • PR Checklist
    • Data Products
      • Data Studio (SQL Analysts)
        • Get Started
          • Write/fork your first query
        • Flipside AI
        • Studio in Depth
          • Query Editor
            • Query Referencing
            • Pro Tips for Querying
            • Keyboard Shortcuts
            • Hex-to-Integer Function
          • Create a Chart
            • Advanced Visualization
          • Build a Dashboard
            • Markdown Reference
          • Team Accounts
        • Tutorials
          • How to Analyze Web3 Data
          • Video Tutorials
            • Overview of Schemas & Tables
            • Ethereum Tutorials
              • Getting Started with Decoded Ethereum Events
              • Getting Started with Ethereum Balances
              • Block Level and Daily Balances
              • Finding Centralized Exchange Flows
            • Solana Tutorials
              • Solana Schema & Tables: Video Walkthrough
              • Solana Specialty Tables: Video Walkthrough
              • Exploring Transactions in solana.events
            • THORChain Tutorials
              • THORChain Schema & Tables
              • Calculating IL for THORChain
          • More Tools & Resources
        • Get Inspired
      • LiveQuery
        • Get Started
        • LiveQuery in Depth
          • Functions
            • 🤝Partner Functions
            • 🧙‍♂️EVM Functions
              • 💡Seaport: Real-time Orders
              • 💡WETH Pool Balances
              • 💡General EVM Node Queries
            • 🤖API Functions
              • 💡Query TheGraph
              • 💡Query Defi Llama
            • ⚙️Utility Functions
              • 💡Hex Converters
              • 💡JSON RPC Request Builder
              • 💡EVM Logs Decoder
              • 💡Keccak256 Encoder
          • QuickNode Setup Guide
        • Secrets Manager
        • Get Inspired
      • Snowflake
      • API/SDK (Developers)
        • Get Started - Your first API call in < 2 min
        • SDK in Depth
          • JSON RPC methods
          • Run A Query
          • Query Results
          • Pagination
          • Sorting
          • Filtering
          • Query Seconds
          • Caching (maxAgeMinutes)
          • Rate Limits
          • Errors
          • More Examples
          • Archive
            • [ARCHIVED] JS/TS SDK
            • ShroomDK Migration Guide
            • [LEGACY] R
        • Tutorials
          • Have Questions?
        • Get Inspired
    • Insights and Tools
  • Earn
    • Flipside Earn
    • Onchain Rewards
      • Quests
    • Analyst Rewards
      • Top Dashboards
        • Top Dashboard Guidelines
        • Skill Tree
      • Ambassador Program
      • Direct to Analyst Commissions
    • Wallet Management
    • Tax Center
  • Support
    • General Support
    • Open a Ticket
      • That email doesn't look quite right
    • 🌟Product Special Releases
      • 2025
        • 2025-02-06 | EVM Blockchain Standardization
          • Table Change Overview
      • 2024
        • 2024-06-13 | Solana native and wrapped addresses
        • 2024-05-01 | Improvements to Pricing Data
          • Actions for Data Studio Users
          • Actions for API Users
          • Action for Data Share Users
    • 🗒️Release Notes
      • 2025
        • 2025-05-01 | Release Notes
        • 2025-04-17 | Release Notes
        • 2025-04-03 | Release Notes
        • 2025-03-20 | Release Notes
        • 2025-03-06 | Release Notes
        • 2025-02-20 | Release Notes
        • 2025-02-06 | Release Notes
        • 2025-01-23 | Release Notes
      • 2024
        • 2024-12-24 | Release Notes
        • 2024-12-12 | Release Notes
        • 2024-11-27 | Release Notes
        • 2024-11-14 | Release Notes
        • 2024-10-31 | Release Notes
        • 2024-10-03 | Release Notes
        • 2024-10-17 | Release Notes
        • 2024-09-19 | Release Notes
        • 2024-09-05 | Release Notes
        • 2024-08-22 | Release Notes
        • 2024-08-08 | Release Notes
        • 2024-07-25 | Release Notes
        • 2024-07-11 | Release Notes
        • 2024-06-27 | Release Notes
        • 2024-06-14 | Release Notes
        • 2024-05-30 | Release Notes
        • 2024-05-16 | Release Notes
        • 2024-05-02 | Release Notes
        • 2024-04-18 | Release Notes
        • 2024-04-05 | Release Notes
        • 2024-03-18 | Release Notes
        • 2024-03-05 | Release Notes
        • 2024-02-20 | Release Notes
        • 2024-02-05 | Release Notes
    • 📊Studio Change log
  • Flipside Community
    • Get Started
    • Ambassador Program
    • Join Our Discord
    • Join Our Guild
Powered by GitBook
On this page
  • UDF_HEX_TO_INT()
  • Syntax
  • Arguments
  • Sample Queries
  • UDF_INT_TO_HEX()
  • Synatx
  • Arguments
  • Sample Query
  • UDF_HEX_TO_STRING()
  • Syntax
  • Arguments
  • Sample Query
  • UDF_BASE58_TO_HEX()
  • Syntax
  • Arguments
  • Sample Query
  • UDF_HEX_TO_BASE58()
  • Syntax
  • Arguments
  • Sample Query
  • UDF_HEX_TO_BECH32()
  • Syntax
  • Arguments
  • Sample Query

Was this helpful?

  1. Data
  2. Data Products
  3. LiveQuery
  4. LiveQuery in Depth
  5. Functions
  6. Utility Functions

Hex Converters

These functions convert from hexadecimal to string and integer formats

UDF_HEX_TO_INT()

Converts from hexadecimal to integer. The number is returned as a string to avoid any big number limitations.

Syntax

utils.udf_hex_to_int(
    [encoding,]
    hex
)

Arguments

Required:

  • hex (string): The hex string to convert

Optional:

  • encoding (string): The encoding to use. Valid values are s2c and hex. This parameter is optimal.

    • Default: hex

Sample Queries

-- These are all the same.
select
  utils.udf_hex_to_int ('1E240')::int as int1,
  utils.udf_hex_to_int ('0x1E240')::int as int2,
  utils.udf_hex_to_int ('hex','0x1E240')::int as int3;

-- Hex to Signed 2's Complement Integer. These are the same.
select
  livequery.utils.udf_hex_to_int ('s2c','FFFE1DC0')::int as int1,
  livequery.utils.udf_hex_to_int ('s2c','0xFFFE1DC0')::int as int2

UDF_INT_TO_HEX()

Synatx

utils.udf_int_to_hex(
    int
)

Arguments

Required:

  • int (integer): The integer to conver

Sample Query

select
  utils.udf_int_to_hex(123)::string as hex

UDF_HEX_TO_STRING()

Converts from hexadecimal to string. It will handle obscure characters like emojis and special characters.

Syntax

utils.udf_hex_to_string(
  hex
)

Arguments

Required:

  • hex (string): The hex string to convert

Sample Query

select utils.udf_hex_to_string('4469616D6F6E642048616E6473') as text1;

UDF_BASE58_TO_HEX()

Converts from base58 to hexadecimal. Typically used for encoding Solana public keys and instructions.

Syntax

utils.udf_base58_to_hex(
  base58
)

Arguments

Required:

  • base58 (string): The base58 string to convert. This cannot be NULL. Output will contain the 0x prefix. If 32 byte outputs are required, append leading zeroes on encoded outputs <= 64 characters (excluding 0x).

Sample Query

select utils.udf_base58_to_hex('3EdUJnbcGFLs') as text1;

UDF_HEX_TO_BASE58()

Converts from hexadecimal to base58. Typically used for decoding within EVM to non-EVM environments, such as Solana.

Syntax

utils.udf_hex_to_base58(
  hex
)

Arguments

Required:

  • hex (string): The hex string to convert. This cannot be NULL and must contain the '0x' prefix.

Sample Query

select utils.udf_hex_to_base58(
    '0x0ed19fefacde5ce40f9a33e6d366f4198f8a00e5b9ae75c306fbb553de9e7e1b') as text1;

UDF_HEX_TO_BECH32()

Converts from hexadecimal to bech32. Typically used for decoding within EVM to non-EVM environments, such as IBC. Requires both a hex string input and HRP (human-readable part), which is chain specific. Please refer to the respective blockchain's documentation for proper HRP input.

Syntax

utils.udf_hex_to_bech32(
  hex,
  hrp
)

Arguments

Required:

  • hex (string): The hex string to convert. This cannot be NULL and must contain the '0x' prefix.

  • hrp (string): The human-readable part to be included within the decoding algorithm. This is empty by default, but is required for proper decoding.

Sample Query

--OSMOSIS
select utils.udf_hex_to_bech32(
    '0x52391ba8acdffc2776ba0ccce8d4c45dd2cbb10f','osmo') as text1;

--SEI
select utils.udf_hex_to_bech32(
    '0x617c7dbac8e4a908f1ac66fdc294b977df527f0f','sei') as text2;

--TERRA
select utils.udf_hex_to_bech32(
    '0x108545dfbddb074d278a7e9488ab6174aea62aa3','terra') as text3;
PreviousUtility FunctionsNextJSON RPC Request Builder

Last updated 1 year ago

Was this helpful?

⚙️
💡