Base58 is a binary-to-text encoding scheme that is commonly used in Bitcoin and Solana. It uses an alphabet of 58 characters, which is the same as the Base64 encoding scheme, but omits the charactersDocumentation Index
Fetch the complete documentation index at: https://docs.dune.com/llms.txt
Use this file to discover all available pages before exploring further.
0, O, I, and l to avoid confusion between similar-looking letters and numbers.
You can use the from_base58 function to convert a Base58-encoded string to a VARBINARY value. For example, the following query converts the Base58-encoded string 3DZBMRwnSU8f to a VARBINARY value:
VARBINARY values, we can use the bytearray_to_bigint function to convert the VARBINARY value to a BIGINT value. However, we need to consider more things:
-
The decoded
VARBINARYvalue does not only contain the data we want to convert to aBIGINTvalue. It also contains a discriminator that indicates which function of a solana program was called. We need to remove this discriminator before we can convert theVARBINARYvalue to aBIGINTvalue. We do this by using thebytearray_substringfunction. -
Solana uses little-endian byte order, so we need to reverse the byte order before we can convert the
VARBINARYvalue to aBIGINTvalue. We do this by using thebytearray_reversefunction.
Functions
from_base58()
from_base58(varchar) → varbinary
Converts a Base58-encoded string to a VARBINARY value.
to_base58()
to_base58(varbinary) → varchar
Converts a VARBINARY value to a Base58-encoded string.